Skip to content

Instantly share code, notes, and snippets.

Created December 3, 2015 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/02967e2c1a7c1757b55f to your computer and use it in GitHub Desktop.
Save anonymous/02967e2c1a7c1757b55f to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/mattnwa 's solution for Bonfire: Chunky Monkey
// Bonfire: Chunky Monkey
// Author: @mattnwa
// Challenge: http://www.freecodecamp.com/challenges/bonfire-chunky-monkey
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function chunk(arr, size) {
var temp = [];
for(var i = 0; i < arr.length; i){
temp.push(arr.slice(i, i+=size));
}
return temp;
}
chunk(["a", "b", "c", "d"], 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment