155
rated 0 times
[
161]
[
6]
/ answers: 1 / hits: 134115
/ 10 Years ago, wed, december 3, 2014, 12:00:00
As we know, to flatten the array [[0, 1], [2, 3], [4, 5]]
by using the method reduce()
var flattened = [[0, 1], [2, 3], [4, 5]].reduce(function(a, b) {
return a.concat(b);
});
So how to flatten this array [[[0], [1]], [[2], [3]], [[4], [5]]]
to [0, 1, 2, 3, 4, 5]
?
More From » arrays