删除数组中的元素
使用splice(会改变原数组)
arr.splice(index,len,item);
//index,删除或者替换的起始位置
//len,删除或者替换的长度
//item,替换的内容
arr = ["a","b","c","d"]
//删除
arr.splice(1,2) ====>["a","d"]
//替换
arr.splice(1,1,"tt") ====> ["a","tt","c","d"]
arr.splice(1,2,"tt") ====> ["a","tt","d"]
//添加
arr.splice(1,0,"ttt") ====> ["a","tt","b","c","d"]
使用remove删除指令的元素
arr.remove(xx)
使用delete
//数组长度不变,置为undefined
delete arr[1] ====> ["a",,"c","d"]
删除对象的属性
使用delete
delete obj.properti
let map = new Map(["name","xxx"])
map.delete("name")