1// ES5 version
2let flattened = [[1, 2], [3, 4], [5, 6]].reduce(function (acc, curVal) {
3 return acc.concat(curVal)
4}, []);
5
6// ES6 version
7let flattened = [[1, 2], [3, 4], [5, 6]].reduce((acc, curVal) => acc.concat(curVal), []);
8
9console.log(flattened); // [1,2,3,4,5,6]