Return to Snippet

Revision: 20065
at November 5, 2009 21:44 by arunpjohny


Initial Code
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]);
					}
				}
			}
		}

Initial URL

                                

Initial Description
This function is add 'each' function to the javascript Array object.

Initial Title
Array.each function

Initial Tags
javascript, array

Initial Language
JavaScript