Skip to content

Instantly share code, notes, and snippets.

I tried to write a function that would flatten nested arrays but my solution did not work when I used the Array.prototype.concat method. As a work around, I used the Array.prototype.forEach method and it worked as expected. Both implimentations are below.
Does you know why .concat() doesn't work?