Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Turn array items to matrix javascript

myArr.reduce((rows, key, index) => (index % 3 == 0 ? rows.push([key]) 
  : rows[rows.length-1].push(key)) && rows, []);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Turn #array #items #matrix #javascript
ADD COMMENT
Topic
Name
1+7 =