Flatten Those Arrays in Javascript
· ☕ 2 min read
Flatten arrays easily with a single command. Or, go further than that by using a map function while flattening arrays.
Consider below example -
1 const nums = [[0, 2], [1, 3], [7, 9, 11]]; You can choose to iterate through all elements if you want to iterate through or access all numbers, or you could just use flat.