Why does console.log() not show inherited properties from Object.create?

前端 未结 2 629
耶瑟儿~
耶瑟儿~ 2021-01-18 09:21

I am running into a hangup while trying to leverage Object.defineProperty() on a base object. I want to inherit properties from that object, using Object.

相关标签:
2条回答
  • 2021-01-18 09:51

    Firebug does log the inherited properties:

    enter image description here

    while Chrome gives you a tree-view which includes the inherited properties:

    enter image description here

    0 讨论(0)
  • 2021-01-18 10:02

    you can use console.dir() where available

    console.dir(derived) 
    

    and it'll show the inherited properties of your object on the __proto__ object

    Edit : doesnt seem to show up on node though

    0 讨论(0)
提交回复
热议问题