浅拷贝
2023年03月19日
一、array.slice()
const array = [1,2,3];
const copies = array.slice();
copies[0] = "1s"
const copies1 = array.slice(0);
copies1[0] = "1s"
console.log(array);
console.log(copies);
console.log(copies1);
const array = [1,2,3];
const copies = array.slice();
copies[0] = "1s"
const copies1 = array.slice(0);
copies1[0] = "1s"
console.log(array);
console.log(copies);
console.log(copies1);