Achatar uma matriz multidimension
// ES5 version
let flattened = [[1, 2], [3, 4], [5, 6]].reduce(function (acc, curVal) {
return acc.concat(curVal)
}, []);
// ES6 version
let flattened = [[1, 2], [3, 4], [5, 6]].reduce((acc, curVal) => acc.concat(curVal), []);
console.log(flattened); // [1,2,3,4,5,6]
Xanthous Xenomorph