Changes all typed array elements from start to end index to the given value and returns the modified typed array.
fill(value, start?, end?)
value
A value with which to fill the array.
start optional
An index at which to start filling. If negative, it is treated as length + start where length is the length of the array.
end optional
An index before which to stop filling. If negative, it is treated as length + end.
The original modified typed array.
new Uint32Array(4).fill(42)
Uint32Array [42, 42, 42, 42]
new Uint32Array([1, 2, 3, 4, 5]).fill(0, 1, 4)
Uint32Array [1, 0, 0, 0, 5]
new Uint32Array([1, 2, 3]).fill(42, -2)
Uint32Array [1, 42, 42]