September 26th, 2024
What's missing in this code?
func([1, 2, 3, 4, 5, 6], 3); // [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]
func([1, 2, 3, 4, 5], 2); // [ [ 1, 3, 5 ], [ 2, 4 ] ]
func([1, 2, 3, 4, 5, 6], 1); // [[1, 2, 3, 4, 5, 6]]
func([1, 2, 3, 4, 5, 6], 6); // [[1], [2], [3], [4], [5], [6]]
func([1, 2], 4); // [[1], [2], [], []]
func([], 3); // [[], [], []];
function func(arr, size) {
return
({ length: size }, (_, i) =>
arr.
((a, b) =>
)
);
}
Type or select from these options