Free tools Windows power users keep installed
One-click scans. No signup required.
JavaScript has seven primitive types—undefined, null, boolean, number, bigint, string, and symbol—and one broad category of object values. The key difference is that primitives are immutable values, while objects can hold mutable properties and be shared through multiple bindings. “Non-primitive” is a common informal label for objects, but null is still a primitive despite what typeof reports.
Primitive and object types at a glance
| Question | Primitive | Object (often called non-primitive) |
|---|---|---|
| What is it? | A value that is not an object | An object value, including arrays and functions |
| Can it be changed in place? | No. Primitive values are immutable. | Object properties or state can ordinarily be changed. |
| What happens when assigned? | The other binding receives that primitive value. | Bindings can refer to the same object, so a mutation through one can be seen through the other. |
| Common examples | "hi", 42, true, null, undefined, 1n, Symbol() |
{}, [], new Date(), and functions |
MDN summarizes the mutability distinction by noting that objects are JavaScript’s only mutable values. The categories describe values, not fixed types assigned permanently to variables: a binding can later be assigned a value of another type.
As an Amazon Associate I earn from qualifying purchases.
Which values are primitives?
The seven primitive types are undefined, null, boolean, number, bigint, string, and symbol. A primitive is not an object. null belongs on this list even though the historical behavior of typeof null is unusual.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Strings and numbers cannot be altered in place. For example, an operation that produces a different string gives you a new primitive value; it does not edit the original string. This is distinct from an object whose properties can be modified.
#1 Best Overall
Arrays, functions, and ordinary objects are objects
Array literals such as [], object literals such as { score: 10 }, dates, and functions are object values. Arrays are objects even though they are designed to represent ordered collections. Functions are callable objects; typeof reports the special string "function" for them.
It is therefore inaccurate to define “non-primitive” as “contains several values.” The decisive distinction is whether the value is an object. An array is an object by category, regardless of how many items it contains.
Rank #2
How assignment and mutation differ
When one primitive value is assigned to another binding, changing the first binding later does not change the second. With objects, two bindings can refer to the same object; changing one of its properties through either binding is visible through the other. Reassigning a binding is still separate from mutating the shared object.
Recommended Free Tools
let first = 10;
let second = first;
first = 20;
console.log(second); // 10
const original = { score: 10 };
const alias = original;
alias.score = 20;
console.log(original.score); // 20
const prevents rebinding original or alias; it does not make the object they refer to immutable. These examples describe observable JavaScript behavior without assuming a particular physical memory layout.
How to check a value’s type
typeof is useful for many primitive categories, but it is not a complete taxonomy of object kinds. In particular, it returns "object" for both null and arrays, and "function" for callable functions.
| Value category | typeof result |
|---|---|
undefined |
"undefined" |
null |
"object" (historical quirk) |
| Boolean | "boolean" |
| Number | "number" |
| BigInt | "bigint" |
| String | "string" |
| Symbol | "symbol" |
| Function | "function" |
| Other objects, including arrays | "object" |
Handle the common exceptions explicitly:
if (value === null) {
// null primitive
} else if (Array.isArray(value)) {
// array object
} else {
console.log(typeof value);
}
Use value === null to identify null and Array.isArray(value) to identify arrays. For other object categories, use a check suited to the particular type. instanceof is not a universal primitive-versus-object detector.
Rank #4
Why can a primitive string have methods?
JavaScript temporarily wraps most primitive values when property access or a method call needs it. That convenience does not turn a primitive literal into an object. For example, "hello" is a primitive string, while new String("hello") creates a String wrapper object. The distinction is observable with instanceof:
console.log("hello" instanceof String); // false
console.log(new String("hello") instanceof String); // true
For ordinary string values, prefer the primitive form rather than explicitly creating a wrapper object.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




