DEV Community

Discussion on: reduce() - Flatten an array of arrays

Collapse
jcubic profile image
Jakub T. Jankiewicz • Edited on

There is Array.prorotype.flat() that do the same and more because it can do nested arrays of any level.

Collapse
takuyakikuchi profile image
Takuya Kikuchi Author

Excellent point!
I have added the information 👍

And I think if you want to flatten an array, using flat() is more intuitive and readable than doing it with reduce().

Anyway, thanks for your comment!