javascript删除数组元素的新方法
作者:互联网
用循环中的filter方法。
var colors = ["red", "blue", "grey"]; colors = colors.filter(function(item) { return item != "red" }); console.log(colors); // ["blue", "grey"]
在 https://www.cnblogs.com/yanggb/p/11464821.html 此博客看到的船新版本,你值得拥有
标签:blue,删除,javascript,grey,filter,item,colors,数组,red 来源: https://www.cnblogs.com/xiaoyuannull/p/15533428.html