Explain the difference between classical inheritance and prototypal inheritance in JavaScript.

Instruction: Describe the two inheritance models and discuss how JavaScript implements prototypal inheritance.

Context: This question evaluates the candidate's understanding of JavaScript's object model and its differences from classical inheritance paradigms.

Updated

Official answer available

Read the opening below, then unlock the full answer and practical guidance.

Class-based languages organize inheritance around declared classes. JavaScript property lookup follows an object's internal prototype link: an own property wins, otherwise lookup continues along the chain until a matching property or null is reached.

JavaScript does have class syntax...

Related Questions