Skip to solution
mediumFrontend

Explain prototypal inheritance.

557 views
01

Understand the problem

Question presented to candidate: "Explain what prototypal inheritance actually is in JavaScript, and how the mechanism works under the hood."

What a strong answer should cover:

  • Every JavaScript object has a hidden internal link, the [[Prototype]] slot, pointing to another object (or to null).
  • Property lookup walks this link: if a property is not found directly on an object, the engine automatically checks the object's prototype, then that prototype's own prototype, and so on, until it finds the property or reaches null.
  • Object.create(proto) is the most direct way to create an object with a chosen prototype, with no constructor function involved at all.
  • Ctor.prototype (a plain object property that lives on a function) and instance.proto (the actual internal link on an instance) are two distinct but related things, and mixing them up is a very common source of confusion.
  • Because lookup happens live at call time rather than by copying, patching a shared prototype after instances already exist changes the behavior of every existing instance -- inheritance is genuinely dynamic, not a one-time copy.

Clarifying questions expected:

  • "Should I also contrast this with classical, class-based inheritance, or focus purely on how the JavaScript mechanism itself works?" (the comparison has its own dedicated question)

Code / implementation expected: Yes -- a runnable snippet showing Object.create-based delegation and a live patch to a shared prototype changing an existing instance's behavior.

prototypesinheritanceobjectsoop
02

Attempt it yourself

Sketch your approach before reading the solution — that's what interviews test.

Nudge consolestandby

Stuck? Beam a request up — the console returns a conceptual nudge that guides your logic without spoiling the implementation.

03

Study the solution

Target Audience: Engineers preparing for JavaScript object-model and inheritance interview questions. Difficulty: Medium

How to read this doc: Concepts are explained in plain language first, then tagged with 📌 Interview term:. Every result below was actually run on Node.js v24.19.0 — the pr

Solution ready — 2 min read

Classified // press E to declassify

04

Run the code

JSObject.create delegation, prototype vs __proto__, and live (non-copied) inheritance (run directly)
05

Join the discussion

Discussion (0)

Sign in to join the discussion.

No responses yet. Be the first to share what you think.

Transmission complete // awaiting log

KEEP THE
STREAK ALIVE.

Dossier 83 of 165 decoded in the JavaScript track. One more won't hurt.

Back to track