Skip to content

Commit

Permalink
each function
Browse files Browse the repository at this point in the history
  • Loading branch information
dalsgaard committed Mar 23, 2015
1 parent cba534f commit 77897c8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/each.js
@@ -0,0 +1,13 @@

var foo = {};

foo.each = function(list, callback) {
for (var i = 0; i < list.length; i++) {
callback(list[i]);
}
};

foo.each([1,2,4,8], function (e) {
console.log(e * e);
});

0 comments on commit 77897c8

Please sign in to comment.