HardPrototypes & Inheritance💻 Output Question

Constructor property points back to the class

💡

Hint

constructor property is inherited from the class prototype — it's useful for identifying an object's constructor.

What does this output?

class Point {
  constructor(x, y) { this.x = x; this.y = y; }
}
const p = new Point(1, 2);
console.log(p.constructor === Point);
console.log(p.constructor === Object);
console.log(p instanceof Point);

Correct Output

true
false
true

Why this output?

Explanation: p.constructor is inherited from Point.prototype and points to Point. It is not Object.

Key Insight: constructor property is inherited from the class prototype — it's useful for identifying an object's constructor.

More Prototypes & Inheritance Output Questions

Easyinstanceof traverses the prototype chainMediumhasOwnProperty vs in operatorMediumClass method override and instanceofMediumsuper calls the parent method

Practice predicting output live →

66 output questions with instant feedback

💻 Try Output Quiz