数组删除元素
let a = ['222','333'];
let index = a.indexOf('333');
if(index!=-1)
a.splice(index,1);
结果:["222"]
数组添加
let a= [];
a.push('test');
结果:["test"]
数组filter
let a = ['test','test1','test3'];
a.filter((item) = >{
return item!='test1'
})
结果:["test", "test3"]
数组合并
let a = ['test','test3'],b = ['test2'];
a.concat(b);
结果:["test", "test3", "test2"]
数组slice
let a = ["test", "test2", "test3", "test4"];
a.slice(2);
a.slice(0,-1);
结果1:[ "test3", "test4"]
结果2:["test", "test2", "test3"]