Back to feed
Dev.to
Dev.to
5/10/2026
Primitive and Reference Values in JavaScript

Primitive and Reference Values in JavaScript

Short summary

JavaScript distinguishes between primitive values (strings, numbers, booleans, null, undefined, bigint, symbol)—immutable with no properties—and reference values (objects, arrays) that store pointers to memory addresses. Objects remain mutable even when declared with const because the memory address itself is immutable, not the data it references. Two objects with identical properties compare unequal because they reference different memory locations.

  • Primitives are immutable atomic values; references are pointers to object data in memory
  • const prevents reassignment of the reference itself, allowing property mutation of the referenced object
  • Object equality checks reference identity, not structural equivalence

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Explore more