In your code:
b.constructor.prototype === A; // false
This is false because the prototype of b is the prototype of A not A itself. This may sound confusing at first so I left an example below:
class A {}
class B extends A {}
const b = new B()
Object.getPrototypeOf(b.constructor) === b.constructor.prototype // false
Object.getPrototypeOf(b.constructor) === A // true
b.constructor.prototype === A // false. why?
console.dir(b.constructor.__proto__ === A); // true
In this example in the last statement:
console.dir(b.constructor.__proto__ === A); // true
The __proto__
property of b actually refers to the same object, A.
You may find the following also interesting:
class A {}
console.log(typeof A); // constructors are merely masked functions with added functionality
console.log(typeof A.__proto__); // constructors inherit from the Function object
console.log(typeof A.__proto__.__proto__); // the Function object inherits from Object object