Flatten [[1,2],[3],[4,5]] to [1,2,3,4,5].
Ready — edit the code above and click Run.
const nested = [[1, 2], [3], [4, 5]];
console.log(nested.flat());
Try solving on your own first, then reveal the official answer.
flat() with depth 1. Deep flatten uses flat(Infinity) or recursion.