Skip to content

Instantly share code, notes, and snippets.

@james2doyle
Created September 6, 2012 16:56
Show Gist options
  • Save james2doyle/3658494 to your computer and use it in GitHub Desktop.
Save james2doyle/3658494 to your computer and use it in GitHub Desktop.
Nodelist object prototype for each function
Object.prototype.each = function(callback) {
var a = [];
for (var i = 0; i < this.length; i++) {
a[i] = this[i];
callback(a[i]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment