Return a new array with one changed position.

Updating Arrays

update_array.js
const index = 1;
const updated = [10, 20, 30]
  .map((value, i) => (i === index ? value + 1 : value))
  .join(",");
const changed = "index=" + index;

console.log("updated=" + updated);
console.log("changed=" + changed);
update-array `map` can create a new array with one position changed. The original values are read, not edited in place.