I know that
Object.getPrototypeOf(Object.getPrototypeOf(Object)) === Object.prototype; // true
But why they design Object like this?
function A(){};
A.prototype = A.__proto__ = new A();
A instanceof A;// true
I know that
Object.getPrototypeOf(Object.getPrototypeOf(Object)) === Object.prototype; // true
But why they design Object like this?
function A(){};
A.prototype = A.__proto__ = new A();
A instanceof A;// true
How else would they have designed it? It follows naturally from the rules "The Object
constructor is a function", "Every function inherits from Function.prototype
", "Every function is an object" and "Every object inherits from Object.prototype
".