We’ll look at what’s included in the latest version of ECMAScript: ES2019 in this lesson.

 

Array.prototype.flat() / Array.prototype.flatMap()

Array.prototype.flat() will flatten the array recursively up to the depth that we specify. If no depth argument is specified, 1 is the default value. We can use Infinity to flatten all nested arrays.

Get hands-on with 1200+ tech skills courses.