JavaScript arrays are getting two new methods. `Array.prototype.flat()` returns a new array with all sub-array elements concatenated into it recursively up to the specified depth. The sub-array elements become members of the new array. `Array.prototype.flatMap()` first maps each element using a mapping function, then flattens the result into a new array. This method is functionally equivalent to a map followed by a flatten of depth 1.
Documentation
Specification
Status in Chromium
Enabled by default (tracking bug) in:
- Chrome for desktop release 69
- Chrome for Android release 69
- Android WebView release 69
Consensus & Standardization
After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.
- No signal
- No signal
- No signal
- Positive
Owner
Last updated on 2020-11-09