Skip to main content

Modeling structured data

JavaScript Objects: Properties, Copies, and Prototypes

Objects group named properties. Their reference identity, shallow-copy behavior, and prototype delegation explain many common JavaScript surprises.

JavaScriptbeginner4 min readJavaScript fundamentals

Learning overview

Estimated time
4 minutes
Difficulty
Beginner
Prerequisites
No prior experience required
Learning outcome
Explain javascript using a clear mental model · Apply javascript in practical JavaScript work
Last updated
July 18, 2026

Model records with named properties

Use dot notation for known valid identifiers and bracket notation for computed keys. Destructuring extracts values into local bindings and can provide defaults when a property is undefined.

course-object.js
const course = {
  id: "javascript",
  title: "JavaScript Fundamentals",
  stats: { lessons: 24, completed: 8 },
};

const { title, stats: { completed = 0 } } = course;
const field = "title";
console.log(course[field]);

Understand identity and shallow copies

Two separately created objects are not strictly equal even when their properties match. Assignment copies a reference, while spread creates a new outer object and preserves references to nested values.

object-update.js
const updated = {
  ...course,
  stats: {
    ...course.stats,
    completed: course.stats.completed + 1,
  },
};

console.log(updated !== course); // true
console.log(updated.stats !== course.stats); // true

Recognize prototype delegation

When an object lacks an own property, JavaScript may look up its prototype chain. Class syntax builds on this delegation model. Prefer composition and plain data objects unless shared prototype behavior provides a clear benefit.

Frequently asked questions

Why are two identical JavaScript objects not equal?

Strict equality compares object identity, not a recursive comparison of properties. Two object literals create two distinct identities.

When should I use Map instead of an object?

Use Map when keys are not limited to strings and symbols, insertion order and size are central, or frequent dynamic key operations benefit from its dedicated API.

Topic graph

A taxonomy-generated path through this subject.

  1. JavaScript
  2. JavaScript fundamentals
  3. javascript
  4. objects
  5. prototypes
  6. data-modeling
  7. What Is JavaScript in Programming?
  8. Learn JavaScript: From Fundamentals to Web Applications
  9. JavaScript Tutorial: Build a Filterable Task List

Recommended automatically from shared technologies, topics, intent, and difficulty.

Hand-picked companion pages that deepen this topic.

Your next steps

Continue learning

  1. 1glossaryWhat Is JavaScript in Programming?
  2. 2guidesLearn JavaScript: From Fundamentals to Web Applications
  3. 3guidesJavaScript Tutorial: Build a Filterable Task List
  4. 4cheatsheetsJavaScript Cheatsheet: Syntax, Collections, DOM, Async