Created
July 30, 2018 09:58
-
-
Save mgmgpyaesonewin/02cae83651b2897496cb76057a00fed7 to your computer and use it in GitHub Desktop.
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
Object.defineProperty(Array.prototype, 'chunk', { | |
value: function(n) { | |
// ACTUAL CODE FOR CHUNKING ARRAY: | |
return Array.range(Math.ceil(this.length/n)).map((x,i) => this.slice(i*n,i*n+n)); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment