如何从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