JavaScript prototypes

JavaScript prototypes, prototype chain, and prototypal inheritance

Learn JavaScript prototypes with focused lessons on the prototype chain, prototypal inheritance, constructor function prototypes, native prototypes, prototype methods, objects without __proto__, classes, instanceof, mixins, and object-oriented JavaScript.

Prototype and inheritance lessons

  1. Prototype chain

    Follow how JavaScript looks up missing properties through an object's prototype chain.

    Outcome: Explain inherited properties and methods without treating classes as magic.

    • JavaScript prototype
    • prototype chain
    • prototypal inheritance
    Study Prototypal inheritance
  2. Constructor function prototypes

    Learn how constructor functions share methods through the prototype property.

    Outcome: Connect constructor functions to reusable object behavior.

    • function prototype
    • constructor prototype
    • new operator prototype
    Study F.prototype
  3. Native prototypes

    Understand built-in prototypes behind arrays, functions, strings, objects, and other native values.

    Outcome: Reason about methods inherited from JavaScript built-ins.

    • native prototypes
    • built-in prototypes
    • Array prototype
    Study Native prototypes
  4. Prototype methods

    Work with prototype methods and object creation patterns that avoid direct __proto__ usage.

    Outcome: Use safer prototype APIs in modern JavaScript code.

    • prototype methods
    • Object.create
    • objects without __proto__
    Study Prototype methods, objects without __proto__
  5. Classes on top of prototypes

    Connect class syntax to the same prototype model used by constructor functions and object inheritance.

    Outcome: Read class code while understanding its underlying prototype behavior.

    • JavaScript classes prototypes
    • class syntax
    • prototype class
    Study Class basic syntax
  6. Class inheritance

    Use extends and super while understanding how class inheritance still relies on prototypes.

    Outcome: Model specialized object types without losing the prototype mental model.

    • class inheritance
    • extends JavaScript
    • super JavaScript
    Study Class inheritance
  7. instanceof checks

    Check values against constructor or class hierarchies and understand how instanceof follows prototypes.

    Outcome: Validate object instances without confusing plain objects and class instances.

    • instanceof JavaScript
    • constructor check
    • prototype check
    Study Class checking: "instanceof"
  8. Mixins and composition

    Share behavior across class hierarchies with mixin patterns when single inheritance is too restrictive.

    Outcome: Reuse object behavior without forcing every type into one inheritance tree.

    • JavaScript mixins
    • class composition
    • prototype behavior
    Study Mixins