A quick side note: if your unaware of the term flattening an array, flattening an array will return a one dimensional array from a nested array.
const flatten = a => .concat(...a);
const flatten = a => .concat.apply(, a);
const flatten = a => a.reduce( (b, c) => b.concat(Array.isArray(c) ? flatten(c) : c),  );
const flatten = a => a.some(Array.isArray) ? flatten(.concat(...a)) : a;