/ Published in: JavaScript

This function is add 'each' function to the javascript Array object.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
if(typeof Array.prototype.each != 'function'){ Array.prototype.each = function(callback, context){ if(this.length > 0 && typeof callback == 'function'){ for(var i = 0; i < this.length; i++){ callback.call(context || window, this[i]); } } } }
Comments
