Created
March 17, 2018 12:08
-
-
Save ConnectedReasoning/59421f105ae61e0cb9b021486cf8a570 to your computer and use it in GitHub Desktop.
Array chunking
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
chunk(fieldArray, size) { | |
var chunkedArray = []; | |
for (var i=0; i<fieldArray.length; i+=size) { | |
chunkedArray.push(fieldArray.slice(i, i+size)); | |
} | |
return chunkedArray; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment