Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2016.
The fill() method of TypedArray instances changes all elements within a range of indices in a typed array to a static value. It returns the modified typed array. This method has the same algorithm as Array.prototype.fill().
Value to fill the typed array with.
start OptionalZero-based index at which to start filling, converted to an integer.
end OptionalZero-based index at which to end filling, converted to an integer. fill() fills up to but not including end.
The modified typed array, filled with value.
See Array.prototype.fill() for more details. This method is not generic and can only be called on typed array instances.
| ECMAScript® 2027 Language Specification # sec-%typedarray%.prototype.fill |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 10, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.