a = {x: 1} b = Object.create(a) b.x = 2
b中的x: 1应该会被x: 2覆盖掉吧?枚举一下似乎验证了是被覆盖了
for (i in a){ console.log(a[i]) } // 返回 1 for (i in b){ console.log(b[i]) // 返回 2 }
但是在console中输入
b
返回了object{x: 2,x: 1} 这是啥意思?咋还有个x: 1?
object{x: 2,x: 1}
光阴似箭催人老,日月如移越少年。
http://segmentfault.com/q/1010000000189452
http://segmentfault.com/q/1010000000189452