Flatten Multidimensional Array Flashcards
1
Q
var myArray = [[1, 2],[3, 4, 5], [6, 7, 8, 9]]; We want [1, 2, 3, 4, 5, 6, 7, 8, 9];
Solution 1: Using concat() and apply()
var myNewArray =
A
var myNewArray = [].concat.apply([], myArray);