在JS中,Object和Property的删除用法:
1 var myObject = {name:‘jimmy‘, age:12, height:123} 2 delete myObject["jimmy"]; 3 delete myObject.age; 4 with (myObject) { 5 delete height; 6 } 7 8 // and an object 9 var myObject = new Object(); 10 delete myObject; 11 12 var myObj2 = {}; 13 myObj2 = null;
时间: 2024-11-09 16:52:37