Skip to content

Instantly share code, notes, and snippets.

@seogi1004
Created November 27, 2017 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seogi1004/60b881407a11e8b61e8302548b1a9da4 to your computer and use it in GitHub Desktop.
Save seogi1004/60b881407a11e8b61e8302548b1a9da4 to your computer and use it in GitHub Desktop.
Array.prototype.each = function(callback) {
for(i = 0; i < this.length; i++) {
callback(this[i]);
}
};
var test = [ { name : 'a' }, { name : 'b' }, { name : 'c' } ];
test.each(function(elem) {
alert(elem.name);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment