Code Golf · #68
Chunk an array
Difficulty 2/3 · JavaScript
How to play
Write a JavaScript function body that passes all test cases using the fewest characters. Run against examples first, then submit for the full test suite. Eagle < Birdie < Par.
Given [array, size], split the array into chunks of the given size. Return as a JSON string.
Examples
f([[1,2,3,4,5],2]) → [[1,2],[3,4],[5]]
f([[1,2,3],3]) → [[1,2,3]]
Loading your progress...
Your code (function body — receives input)
function(input) { 0 chars
}
Write the shortest JavaScript function body that passes all tests · Back to hub