Knowledgize

.fill(value, start, end)

Fills all the elements of an array from a start index to an end index with a static value.

Examples:

let numbers = [1, 2, 3, 4]; numbers.fill(0, 2, 4); console.log(numbers); // [1, 2, 0, 0]
let numbers = [1, 2, 3, 4]; numbers.fill(5); console.log(numbers); // [5, 5, 5, 5]