1.splice()
(1)详解
splice() 方法用于添加或删除数组中的元素。
注意:这种方法会改变原始数组。
(2)参数
splice(index,homany, item1,......itemx)
(3) 返回值
(4)例子
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.splice(2,1,"Lemon","Kiwi");
结果:Banana,Orange,Lemon,Kiwi,Mango
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.splice(2,2);
结果:Banana,Orange