Object.prototype returns empty object in Node Object.prototype returns empty object in Node node.js node.js

Object.prototype returns empty object in Node


It is because the console.log() in node use util.inspect(), which uses Object.keys() on objects, and it returns enumerable properties only. And Object.prototype contains non-enumerable properties, that is why it returns empty node.

Similar behavior can be observed in the below snippet, when we console.log(Object.prototype) it logs an empty {};

console.log(Object.prototype);