//字面量语法 var obj = { name:‘zhangsan‘, age:30, say:function(){ console.log(‘hello‘); } }; console.log(obj.name);//取name值 console.log(obj[‘age‘]);//[]方式取age值 //删除对象成员 delete obj.age;//删除age obj.say();//调用函数方法
2021-11-24 00:18:24
//字面量语法 var obj = { name:‘zhangsan‘, age:30, say:function(){ console.log(‘hello‘); } }; console.log(obj.name);//取name值 console.log(obj[‘age‘]);//[]方式取age值 //删除对象成员 delete obj.age;//删除age obj.say();//调用函数方法