Created
June 28, 2020 18:18
-
-
Save brocard/42e477455ef86bfef7906614d81ef437 to your computer and use it in GitHub Desktop.
chunk array javascript
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
chunkArray(arr, n) { | |
return arr.length ? [arr.slice(0, n), ...this.chunkArray(arr.slice(n), n)] : []; | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment