JSFiddle - React, Tailwind, and code Playground
by Tom M
JavaScript
let arr = [5,[1, 2],[3, 4, 5], [6, 7, 8, 9]];
let flat = arr.reduce(function(a,b) {
return b.concat(a);
})
console.log(flat);
by Tom M
let arr = [5,[1, 2],[3, 4, 5], [6, 7, 8, 9]];
let flat = arr.reduce(function(a,b) {
return b.concat(a);
})
console.log(flat);