📜  javascript拼接而不更改数组 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:03:23.258000             🧑  作者: Mango

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