Skip to content

Instantly share code, notes, and snippets.

@seriousManual
Created September 17, 2014 11:26
Show Gist options
  • Save seriousManual/c187807fba3f92b67f82 to your computer and use it in GitHub Desktop.
Save seriousManual/c187807fba3f92b67f82 to your computer and use it in GitHub Desktop.
iterate an array of arrays
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