Skip to content

Instantly share code, notes, and snippets.

@staxmanade
Last active August 29, 2015 14:12
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 staxmanade/ec00ba5f030b6d73f68c to your computer and use it in GitHub Desktop.
Save staxmanade/ec00ba5f030b6d73f68c to your computer and use it in GitHub Desktop.
forEach implementation on the JavaScript Object
Object.prototype.forEach = function(callback) {
var key = 0;
for (key in this) {
if (this.hasOwnProperty(key)) {
if (callback.call(this, key, this[key]) === false) {
break;
}
}
}
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment