在 JavaScript 中,Splice
函数就像一个大胆的魔术师,直接对原始数组进行变戏法 —— 修改、更新,甚至是彻底改变它的面貌。比方说:
const test = ['angel', 'clown', 'mandarin', 'sturgeon'];
test.splice(2, 1, 'first');
console.log(test);
> ['angel',
在 JavaScript 中,Splice
函数就像一个大胆的魔术师,直接对原始数组进行变戏法 —— 修改、更新,甚至是彻底改变它的面貌。比方说:
const test = ['angel', 'clown', 'mandarin', 'sturgeon'];
test.splice(2, 1, 'first');
console.log(test);
> ['angel',