Technical Mid Level

Explain prototypal inheritance in JavaScript. How do ES6 classes relate to prototypes under the hood?

Quick Tip

Show the connection: "ES6 class methods are defined on Constructor.prototype, exactly like the old pattern. class extends sets Child.prototype = Object.create(Parent.prototype). It is syntactic sugar, not a new model."

What good answers include

Every JavaScript object has an internal [[Prototype]] link. Property access walks the prototype chain until found or reaching null. ES6 classes are syntactic sugar over constructor functions and prototypes — they do not introduce a new object model. class methods go on the prototype, class fields go on instances, and extends sets up the prototype chain. Strong candidates explain: Object.create, __proto__ versus prototype property, and how class syntax makes prototype patterns more readable without changing the mechanics.

What interviewers are looking for

Core language understanding. Candidates who think classes are like Java classes will be confused by JavaScript behaviour. Those who understand the prototype chain can debug inheritance issues and make informed design choices.

← All JavaScript questions