0

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

1 Answers1

0

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".

Bergi
  • 630,263
  • 148
  • 957
  • 1,375