Created
January 24, 2017 19:38
-
-
Save basekays/3e2e080cfe1dde35c480411adee5b30d to your computer and use it in GitHub Desktop.
_.each syntax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Call iterator(value, key, collection) for each element of collection. | |
| // Accepts both arrays and objects. | |
| // | |
| // Note: _.each does not have a return value, but rather simply runs the | |
| // iterator function over each item in the input collection. | |
| _.each = function(collection, iterator) { | |
| _.each(collection, iterator(value, key, collection) { | |
| } | |
| }; |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
_.each = function(collection, iterator) {
if (Array.isArray(collection)) {
for (var i = 0; i<collection.length; i++) {
_.each(iterator (value, key, collection)) {
};