Javascript Array eachItem( cb )
//forEach method/*from w w w.j a va 2 s.c o m*/ //must take a function as an argument and call that function against each element in the array //recommended to use a callback Array.prototype.eachItem = function( cb ) { for (var i = 0; i < this.length; i++) { cb(this[i]); } }; // //Extra method // //must take an array function written in ArrayFun and add them to the Array.prototype // Array.prototype.extra = function(first_argument) { // // body... // };