remove one item from the middle of an array without mutating 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");