EasyPrototypes & Inheritance💻 Output Question

instanceof traverses the prototype chain

💡

Hint

instanceof traverses the full prototype chain. All objects are ultimately instanceof Object.

What does this output?

console.log([] instanceof Array);
console.log([] instanceof Object);
console.log({} instanceof Array);

Correct Output

true
true
false

Why this output?

Explanation: Arrays inherit from Array.prototype AND Object.prototype. [] instanceof Object is true. {} does not inherit from Array.

Key Insight: instanceof traverses the full prototype chain. All objects are ultimately instanceof Object.

More Prototypes & Inheritance Output Questions

MediumhasOwnProperty vs in operatorMediumClass method override and instanceofMediumsuper calls the parent methodMediumObject.create sets prototype directly

Practice predicting output live →

66 output questions with instant feedback

💻 Try Output Quiz