Typed Array fill()
Description
The fill()
method fills specified elements in a typed array with a value.
The fill()
method overwrites the original typed array.
Start and end position can be specified. If not, all elements will be filled.
Syntax
typed-array.fill(value, start, end)
Parameters
Parameter | Description |
value | Required. The value to fill in. |
start | Optional. The start index (position). Default is 0. |
end | Optional. The stop index (position). Default is array length. |
Return Value
Type | Description |
Array | The filled array. |
JavaScript Typed Arrays
Browser Support
fill()
is an ECMAScript6 (ES6 2015) feature.
JavaScript 2015 is fully supported in all modern browsers since June 2017:
Chrome 51 | Edge 15 | Firefox 54 | Safari 10 | Opera 38 |
May 2016 | Apr 2017 | Jun 2017 | Sep 2016 | Jun 2016 |
fill()
is not supported in Internet Explorer.