Search code examples
javascriptgoogle-chrome-devtoolsprototypejavascript-debugger

Display of __proto__ vs [[Prototype]] in Chrome Developer Tools


I am learning Java Script and I see the examples that were published a few years ago show __proto__ in the chrome developer tool - console while explaining the prototypical inheritance concept.

When I execute the same sample code I don't see __proto__ anymore in my current version of Chrome. I only see [[Prototype]].

enter image description here

enter image description here

Questions:

  1. Hope both are the same? If yes, from which version that this change has taken place.
  2. Is it possible to revert my chrome developer tool to older version to view it as __proto__?

Solution

  • Yes, they are the same. It was reported as a bug and then changed somewhen around April 2021 (Chrome 92), to better align with the spec and follow Firefox devtools' lead.

    No, you cannot change it back.

    The [[prototype]] syntax reflects that it is an internal slot (also here) exposed only by the debugger, not some normal property. Using __proto__ as an alias causes quite some confusion, because object actually can have a normal property of that name, and there's also the old deprecated Object.prototype.__proto__ getter/setter that did access the [[prototype]].