A wagon holding an array carries crates on its roof: flat() unpacks one level a step on track 2 up to the depth asked or Infinity. What happens to the holes…
Try it in this playground
Run flat() on stacked crates One level is opened, the rest stay crates.
Try flat(Infinity) See how many levels are really opened before it stops.
Flatten a train with empty slots Write [1, , 3] or use the missing-wagons situation: empty slots do not come along.
Do not keep the result A new train comes in, nobody points at it, and arr stays nested.