Javascript Array myEach(blk)
Array.prototype.myEach = function(blk){ for (var i = 0; i < this.length; i++){ blk(this[i]);/*from w w w .java 2 s .com*/ } return this; }; // [1,2,3,4].myEach(console.log);