Comment remplacer l'élément de tableau en javascript sans mutation

function replaceAt(array, index, value) {
  const ret = array.slice(0);
  ret[index] = value;
  return ret;
}
const newArray = replaceAt(items, index, "J");

Cooperative Corncrake