Skip to content

Instantly share code, notes, and snippets.

@trico
Created August 5, 2011 09:40
Show Gist options
  • Save trico/1127213 to your computer and use it in GitHub Desktop.
Save trico/1127213 to your computer and use it in GitHub Desktop.
each javascript
Array.prototype.each = function(fn){
var len = this.length;
for(i = 0; i < len; i++){
fn(this[i]);
}
};
['mogla', 'es', 'dios'].each(function(v){
console.log(v);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment