how to change a value at a particular index in an array without mutating js code example
Example: how to replace array element in javascript without mutation
function replaceAt(array, index, value) {
const ret = array.slice(0);
ret[index] = value;
return ret;
}
const newArray = replaceAt(items, index, "J");