Home »
MCQs »
Lodash MCQs
What will be the output of the following code (3) (Lodash)?
11. What will be the output of the following code?
array = [1, 2, 3, 4, 5, 6, 7, 8, 9];
let chunk1 = _.chunk(nums, 2);
console.log( chunk1);
- [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], [ 7, 8 ], [ 9 ] ]
- [ 0, 1 ], [ 2, 3 ], [ 4, 5 ], [ 6, 7 ], [ 8,9 ]
- [ [ 0, 1 ], [ 2, 3 ], [ 4, 5 ], [ 6, 7 ], [ 8,9 ] ]
Answer: A) [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], [ 7, 8 ], [ 9 ] ]
Explanation:
The following will be the output: [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], [ 7, 8 ], [ 9 ] ]