Answers for "how to replace array element in javascript without mutation"

0

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");
Posted by: Guest on April-11-2020

Code answers related to "how to replace array element in javascript without mutation"

Code answers related to "Javascript"

Browse Popular Code Answers by Language