function Parent () {}
Parent.prototype.x = 1
const child = new Parent()
// []
Object.keys(child)
// 'x'
for (let k in child) {
console.log(k)
}
// configurable: true
// enumerable: true
// value: 1
// writable: true
Object.getOwnPropertyDescriptor(Parent.prototype, 'x')
网友评论