Wednesday, 13 February, 2019 UTC


ES2019 introduces the Array.prototype.flatMap method. In this lesson, we'll map and flatten a multidimensional array using, Array.prototype.reduce and Array.prototype.concat, and then refactor the code to do the same thing using the .flatMap method. Then, we'll see how we can use empty arrays in our map function to act as a filter before mapping.