I was looking for the straight solution to convert the multi-dimensional (nested) array into plan array.
So, I ended up on the solution which is flat(). Lets see how it can do wonders for you.
💥 It converts the nested array into plan array.
💪 Optionally, you can pass a depth parameter to decide your array depth. By default, it is 1.
😎 At the end, it returns the flattened new array
You can also use Infinity as parameter for unlimited number of nested array conversion.
That's it! 😀
You can learn more on MDN about flat array method.