Skip to content

Instantly share code, notes, and snippets.

@paveleremin
Created November 4, 2015 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paveleremin/8d2b3590c04aedf0ea79 to your computer and use it in GitHub Desktop.
Save paveleremin/8d2b3590c04aedf0ea79 to your computer and use it in GitHub Desktop.
Array chunk
Array.prototype.chunk = function(len) {
var chunks = [];
for (var i = 0, l = this.length; i < l; i += len) {
chunks.push(this.slice(i, i + len));
}
return chunks;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment