Int8Array.prototype.fill

Changes all typed array elements from start to end index to the given value and returns the modified typed array.

Syntax

fill(value, start?, end?)

Parameters

Return value

The original modified typed array.

Examples

new Int8Array(4).fill(42)
Int8Array [42, 42, 42, 42]
new Int8Array([1, 2, 3, 4, 5]).fill(0, 1, 4)
Int8Array [1, 0, 0, 0, 5]
new Int8Array([1, 2, 3]).fill(42, -2)
Int8Array [1, 42, 42]