Reduce function which un-nests a single level of 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 un-nests a single level of arrays
Example