0Pricing
JavaScript Academy · Lesson

Prototype Chain & Own-Property Basics

Prototype chain basics; check own vs inherited properties; use Object.create; set simple descriptors.

Intro to prototypes

Goal: See how objects inherit through the prototype chain and how to tell own vs inherited keys.

  • Prototype chain
  • hasOwn vs in
  • Object.create
  • Basic descriptors
Prototype Chain & Own-Property Basics — illustration 1

Prototype lookup

If a key is not found on the object, JavaScript looks at its prototype (e.g., Object.prototype).

// A simple object
const user = { name: "Ayla" };

// The prototype is another object used for fallback lookups
const proto = Object.getPrototypeOf(user);

console.log("name:", user.name);
console.log("has toString?", typeof user.toString === "function");
console.log("proto same as Object.prototype?", proto === Object.prototype);
Prototype Chain & Own-Property Basics — illustration 2

All lessons in this course

  1. Prototype Chain & Own-Property Basics
  2. Class Syntax (Preview): constructor, methods, static, extends
← Back to JavaScript Academy