1
Student
100%
Completion rate
chunk.js
Write and export as default the function taking an array and a number that specifies the size of a chunk. The function should return an array of chunks of a given size.
Examples
chunk(['a', 'b', 'c', 'd'], 2);
// [['a', 'b'], ['c', 'd']]
chunk(['a', 'b', 'c', 'd'], 3);
// [['a', 'b', 'c'], ['d']]
For full access to the challenge you need a professional subscription.
A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.