属性是不会重复的只有唯一的属性名
不过有方法可以判断属性是否已经存在
1.in,示例如下
// 返回true
console.log("x" in {x:1})
2.hasOwnProperty方法,示例如下
// 返回true
console.log(({x:1}).hasOwnProperty("x"))
如果属性已经存在而继续对此属性赋值的话,会覆盖之前的值,例如:
var s = {x:1};
// 输出1
console.log(s.x)
s.x = 2;
// 输出2
console.log(s.x)