237 B
237 B
Flatten array
Use recursion.
Use reduce() to get all elements that are not arrays, flatten each element that is an array.
var flatten = arr =>
arr.reduce( (a, v) => a.concat( Array.isArray(v) ? flatten(v) : v ), []);