Created
November 27, 2017 13:50
-
-
Save seogi1004/18529e3760ffb6ee7570e7c2aa03516d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.each = function(callback) { | |
for(i = 0; i < this.length; i++) { | |
callback.prototype = this[i]; | |
new callback(i); | |
} | |
}; | |
var test = [ { name : 'a' }, { name : 'b' }, { name : 'c' } ]; | |
test.each(function(index) { | |
alert(index + " = " + this.name); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment