如何从JavaScript对象中删除项目

2020/09/29 02:01 · javascript ·  · 0评论

如何从JavaScript对象中删除项目?

像这样:

var test = {'red':'#FF0000', 'blue':'#0000FF'};
test.remove('blue');

var test = {'red':'#FF0000', 'blue':'#0000FF'};
delete test.blue; // or use => delete test['blue'];
console.log(test);

这将删除test.blue

本文地址:http://javascript.askforanswer.com/ruhecongjavascriptduixiangzhongshanchuxiangmu.html
文章标签: ,  
版权声明:本文为原创文章,版权归 javascript 所有,欢迎分享本文,转载请保留出处!

文件下载

老薛主机终身7折优惠码boke112

上一篇:
下一篇:

评论已关闭!