Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

array chunk javascript

let input = [1,2,3,4,5,6,7,8,9];
let chunked = []
let size = 2;

for (let i = 0;  i < input.length; i += size) {
  chunked.push(input.slice(i, i + size))
}
console.log(chunked)
 
PREVIOUS NEXT
Tagged: #array #chunk #javascript
ADD COMMENT
Topic
Name
5+4 =