不确定我想要的是否可行,但是
这有效:
pointer = arr1 = ['a','b','c'];
arr1.splice(0, 1);
console.log(pointer); // ['b','c']
我想要什么,但不起作用:
pointer = arr1 = ['a','b','c'];
arr1 = ['e','f'];
console.log(pointer); // desired ['e','f']
console.log(pointer); // reality ['a','b','c']
pointer
除了每次重新分配时不断重新更新变量之外,有什么办法可以解决这个问题arr1
?