flatten

.flatten()

Searches for arrays within this array, and if they are found, they are expanded into this array. This also works recursively.

arr = [ 1, [ 2, 3 ], [ 4, [ 5 ]], 6 ]
arr2 = arr.flatten()

console( arr  ) // prints [1, [2, 3], [4, [5]], 6]
console( arr2 ) // prints [1, 2, 3, 4, 5, 6]