JS Built-ins
TypedArrayfillbeginner

TypedArray.prototype.fill()

πŸ“– Usage Example
const arr = new Uint8Array(5);
arr.fill(7, 1, 4);
// [0, 7, 7, 7, 0]

fill() fills elements from start to end (exclusive) with a value.

Use the fill() method to fill all elements of a TypedArray with a static value.

πŸ’‘ Hints (1)
  • β€’ new Int32Array(n).fill(value)