Arrays & Iterables
Chunk Array into Groups
easyJS SpecificJS / TS3 tests
Problem Statement
Implement `chunk(array, size)` that splits an array into groups the length of `size`. If the array cannot be split evenly, the final chunk will be the remaining elements.
Examples
Example 1: chunk([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]] Example 2: chunk([1, 2, 3], 5); // [[1, 2, 3]]
JavaScript & TypeScript starter code included
Run this as a live interviewPractice solo
3 test cases. No second person needed.