Commit c5ff2f1b authored by Julien Cigar's avatar Julien Cigar
Browse files

added Array.forEach

parent 14ca6673
...@@ -140,6 +140,18 @@ ...@@ -140,6 +140,18 @@
}; };
} }
/* Array.forEach
* Executes a provided function once per array element.
*/
if (!Array.prototype.forEach) {
Array.prototype.forEach = function(callable, scope) {
for(var i=0, _len = this.length; i < _len; ++i) {
callable.call(scope, this[i], i, this);
}
}
}
/* String.trim /* String.trim
* Removes whitespace from both ends of the string. * Removes whitespace from both ends of the string.
*/ */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment