splice的使用
let myFish = ['angel', 'clown', 'mandarin', 'sturgeon'];
// let newArr = myFish.splice(1,2) //删 :如果没删除则返回空数组
// let newArr = myFish.splice(0,0,'mandarin', 'sturgeon') //增
myFish.splice(2,2,'王五','赵六') //改
console.log(myFish);
只要思想不滑坡,办法总比困难多!
浙公网安备 33010602011771号