Created
September 17, 2014 11:26
-
-
Save seriousManual/c187807fba3f92b67f82 to your computer and use it in GitHub Desktop.
iterate an array of arrays
This file contains 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
var _ = { | |
concat: function() { | |
var arrays = Array.prototype.slice.call(arguments); | |
return { | |
forEach: function(iterator) { | |
arrays.forEach(function(subArray) { | |
subArray.forEach(function(value) { | |
iterator(value); | |
}); | |
}); | |
} | |
} | |
} | |
}; | |
_.concat([1,2,3],[1,2,3]).forEach(console.log); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment