The with
method allows us to change the value of an element in an array at a certain index. It is equivalent to using the bracket notation.
Examples
const numArray = [0, 1, 2, 3];
console.log(numArray.with(2, 4)); //[0, 1, 4, 3]
const anotherArray = [1, 3, 5, 8, 9];
console.log(anotherArray.with(anotherArray.length-2, 7)); //[1, 3, 5, 7, 9]