1 var 对象名={ 2 属性名:属性值, 3 属性名:属性值, 4 属性名:属性值 5 } 6 7 //定义了一个person对象,它有四个属性! 8 var person={ 9 name:"cl", 10 age:19, 11 email:"123456789@qq.com", 12 score:0 13 }
js中对象,{.....}表示一个对象,键值对描述属性 xxxx:xxxx,多个属性之间使用逗号隔开,最后一个属性不加逗号!
JavaScript中的所有的键都是字符串,值是任意对象
1 person.name="cl" 2 "cl" 3 person.name 4 "cl"
1 delete haha 2 underfined
1 delete person.name 2 true 3 person
1 person.haha="haha" 2 "haha" 3 person
1 ‘age‘ in person 2 true 3 //继承 4 ‘toString‘ in person 5 true
1 person.hasOwnProperty(‘toString‘) 2 false 3 person.hasOwnProperty(‘age‘) 4 true
原文:https://www.cnblogs.com/clblogs/p/14720037.html