Array flat() and flatMap()
Widely available
The flat()
and flatMap()
methods for arrays creates a new array such that each nested array item is concatenated into it.
To learn more, see
Array.prototype.flat(),
Array.prototype.flatMap() at MDN.
Compatibility (view on caniuse.com)
- Chrome 69 Released on 2018-09-04
- Chrome Android 69 Released on 2018-09-04
- Edge 79 Released on 2020-01-15
- Firefox 62 Released on 2018-09-05
- Firefox for Android 62 Released on 2018-09-05
- Safari 12 Released on 2018-09-17
- Safari on iOS 12 Released on 2018-09-17
Specifications
- ECMAScript Language Specification (#sec-array.prototype.flat), from TC39 (Ecma International).
- ECMAScript Language Specification (#sec-array.prototype.flatmap), from TC39 (Ecma International).