Skip to content

Instantly share code, notes, and snippets.

@piqueen314 piqueen314/g8
Created Dec 11, 2015

What would you like to do?
Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.
// Bonfire: Chunky Monkey
// Author: @piqueen314
// Challenge:
// Learn to Code at Free Code Camp (
function chunk(arr, size) {
var newArr = [];
for (var i=0; i < arr.length; i+=size)
return newArr;
chunk(['a', 'b', 'c', 'd'], 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.