Reduce function which recursively un-nests all arrays
let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ];input.reduce(unnestR, []) // [ "a", "b", "c", "d", "double, "nested" ] Copy
let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ];input.reduce(unnestR, []) // [ "a", "b", "c", "d", "double, "nested" ]
Reduce function which recursively un-nests all arrays
Example