Object, the prototype chain has the property set with set and get methods. this property will also be written into the object automatically.

  node.js, question

1: if the set,get method property is set in the prototype chain of an object, the object will automatically write this property.

2: The code is as follows

let test = {
 a:1,b:2
 bracket
 Object.defineProperty(test,'a',{
 set(){
 return 'set'
 },
 get(){
 return 'get'
 bracket
 })
 let o = {};
 o.__proto__ = test;

3: view o in console

clipboard.png
4: why do o objects also have a attribute?

Seeing is not necessarily believing.

Don’t believe you.Object.getOwnPropertyDescriptor(o, 'a')AndObject.getOwnPropertyDescriptor(test, 'a')Do it separately.

This should only be the debugging tool of chrome for the convenience of displaying and creating effects, which will not happen under firefox.