Array fill()
Widely available since 2019-03-20
The fill()
method of arrays and typed arrays sets all or some items of an array to a given a value.
Learning resources on MDN
Browser support
- Chrome 45 Released on 2015-09-01
- Chrome Android 45 Released on 2015-09-01
- Edge 12 Released on 2015-07-29
- Firefox 37 Released on 2015-03-31
- Firefox for Android 37 Released on 2015-03-31
- Safari 10 Released on 2016-09-20
- Safari on iOS 10 Released on 2016-09-13
Specifications
- ECMAScript® 2025 Language Specification (#sec-array.prototype.fill), from TC39 (Ecma International).
- ECMAScript® 2025 Language Specification (#sec-%25typedarray%25.prototype.fill), from TC39 (Ecma International).
View web-platform-tests results for this feature - View the feature source file - Edit the feature - Report an issue about this feature