Skip to content

Instantly share code, notes, and snippets.

Created December 7, 2015 19:56
Show Gist options
  • Save anonymous/8d58524dd51f51d2647c to your computer and use it in GitHub Desktop.
Save anonymous/8d58524dd51f51d2647c to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/robertsheacole 's solution for Bonfire: Chunky Monkey
// Bonfire: Chunky Monkey
// Author: @robertsheacole
// Challenge: http://www.freecodecamp.com/challenges/bonfire-chunky-monkey#
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function chunk(arr, size) {
var newArray = [];
for(var i = 0; i < arr.length; i){
newArray.push(arr.slice(i, i += size));
}
return newArray;
}
chunk(["a", "b", "c", "d"], 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment