Reputation: 4758
What's the command to make [ [1,2], [3,4] ] become [1,2,3,4] ?
(asked on behalf of someone else)
Upvotes: 0
Views: 520
Reputation: 4758
The .flat
message is what you're after:
[[1,2],[3,4]].flat
there's also .flatten
which gives the same result in this case (but .flatten
only flattens one "level" whereas .flat
will flatten all the way down to a fully-flat array)
Upvotes: 2