The code is simple.
var now = new Date();
console.log(now.__proto__);
console.log(now.__proto__.__proto__);
console.log(now.__proto__.__proto__.__proto__);
In the console of Chrome, the result is shown as the screenshot.
The result seems correct in the console of Node.js.
Why doesn't now.\__proto\__
return Date {}
in Chrome's console?
It's just a rendering, for which there's no specification.
Node does more computation to return the name of the
constructor
of the object whenever possible.If you want to see it in the source, it's a little tedious to read because there are many different cases but it's basically in the
formatValue
function which is called byutil.inspect
.