function chunkArrayInGroups(arr, size) {
// Make empty array
var holderArray = [];
// Always starting at 0 when adding to it
var count = 0;
while (count < arr.length) {
// Push given array to new empty array, sliced up depending on size given
holderArray.push(arr.slice(count, count + size));
// Reset count else infite loop will occour
count = count + size;
}
return holderArray;
}
// Example call
chunkArrayInGroups(["a", "b", "c", "d"], 2);