Here is what I tried:
let a = [[1,2], [3,4]];
a.map(val => ...val)
// => SyntaxError: expected expression, got '...'
// Expected output: [1,2,3,4]
I tried with explicit return
statement and surrounding value with parenthesis but none worked...
I just wonder if there is a simple way to return "spreaded array" ?
Edit: Now I have seen this SO question which has got precision on how spread operator works although in doesn't really answer the question on how to "flatten" an array (I modified the title of the question).