Created
May 9, 2016 04:57
-
-
Save shelldandy/fda8c80665b73b18e818f5a9a786f4d2 to your computer and use it in GitHub Desktop.
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
function chunkArrayInGroups(arr, size) { | |
var chunky = []; | |
var arraySize = arr.length; | |
for(var i = 0; i < arraySize; i+= size) { | |
chunky.push(arr.slice(i, i+size)); | |
} | |
return chunky; | |
} | |
chunkArrayInGroups( ["a", "b", "c", "d"], 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment