const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9];
let x = [];
for (let i = 0; i < arr.length; i += 3) {
x.push(arr.slice(i, i + 3));
}
console.log(x);
// Output: [[1,2,3],[4,5,6],[7,8,9]]
const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9];
let x = [];
for (let i = 0; i < arr.length; i += 3) {
x.push(arr.slice(i, i + 3));
}
console.log(x);
// Output: [[1,2,3],[4,5,6],[7,8,9]]
For further actions, you may consider blocking this person and/or reporting abuse
Jasskaran Singh Shangari -
Shubham Tiwari -
genix -
TailAdmin -
Top comments (0)