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. [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], [ 7, 8 ], [ 9 ] ]
  2. [ 0, 1 ], [ 2, 3 ], [ 4, 5 ], [ 6, 7 ], [ 8,9 ]
  3. [ [ 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 ] ]

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.