What's new in ES2019?
Let's look at what new features will be coming to JavaScript
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.
Array.prototype.flatMap() is identical to the previous one with regards to the way it handles the depth argument, but instead of simply flattening an array, with flatMap() we can ...