0

What's the command to make [ [1,2], [3,4] ] become [1,2,3,4] ?

(asked on behalf of someone else)

Dan Stowell
  • 4,618
  • 2
  • 20
  • 30

1 Answers1

2

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)

Dan Stowell
  • 4,618
  • 2
  • 20
  • 30