HardPrototypes & Inheritance💻 Output Question

Prototype changes visible to existing instances

💡

Hint

Prototype changes are immediately reflected in all existing instances — the chain is looked up dynamically at call time.

What does this output?

function Vehicle(type) { this.type = type; }
const car = new Vehicle('car');
Vehicle.prototype.describe = function() {
  return 'I am a ' + this.type;
};
console.log(car.describe());

Correct Output

I am a car

Why this output?

Explanation: Adding to the prototype AFTER creating instances still works — prototype lookup is dynamic, not a snapshot at creation time.

Key Insight: Prototype changes are immediately reflected in all existing instances — the chain is looked up dynamically at call time.

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