JavaScript · Middle · Question 75 of 75
What does arr.with(1, "x") return for arr = ["a", "b", "c"]?
- ✓Correct answer: A new array
["a", "x", "c"];arris unchanged - 2It changes
arrto["a", "x", "c"] - 3
"b", the replaced value
Explanation
with is the immutable counterpart of arr[1] = "x". It supports negative indices like at and throws RangeError for out-of-range ones.