The fill() method of an array returns an array by filling all elements with a specified value. Starting at an optional start index and ending at an optional end index.
const numbers = [2, 4, 6, 8];
const fill = numbers.fill(6);
console.log(fill);
// [6, 6, 6, 6]
const numbers1 = [0, 1, 2, 3, 4];
const fill2 = numbers1.fill(9, 2, 5);
console.log(fill2);
// [0, 1, 9, 9, 9]