1.根据索引删除数组元素
delete 数组[索引]
var arr1=["aa","bb","cc","dd"];
delete arr1[2];
运行之后: arr=["aa","bb",undefined,"dd"];
delete 它是将内容删除为空,但是元素的个数不变
2.根据元素内容直接删除数组元素
splice(index,len,[item])
index:数组开始下标
len: 替换/删除的长度
item:替换的值,删除操作的话 item为空
var arr2=["aa","bb","cc","dd"];
arr2.splice(2,1);//删除数组索引2的位置以后的1个元素
运行之后:arr=["aa","bb","dd"];