You can see what data types are primitives here on MDN: https://developer.mozilla.org/en-US/docs/Glossary/Primitive Technically, the differences can be subtle, but the big difference is that primitives are immutable, meaning you can't add to or modify properties within them like you can with objects. While you can have objects that are also immutable, primitives are always immutable. If you ever need to change a primitive value, it always has to be reassigned. It can't be modified. Primitives also generally represent a low-level value, not something complex. Things like numbers, strings and booleans make up primitives while more complex types like Dates and Arrays are defined by objects. Most primitives also have object variations of themselves. For example you can have the primitive number 5 or the number object new Number(5). However, you should almost always avoid the object version of primitive types and stick to using their primitive values. Answer from senocular on reddit.com
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › primitive-and-non-primitive-data-types-in-javascript
Primitive and Non-primitive data-types in JavaScript - GeeksforGeeks
These data types are broadly categorized into two groups: Primitive Data Types and Non-Primitive Data Types. Let us discuss it one by one. Primitive data types are the built-in data types provided by JavaScript.
Published   July 23, 2025
🌐
Mozilla
developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Data_structures
JavaScript data types and data structures - JavaScript | MDN
For symbols and BigInts, JavaScript has intentionally disallowed certain implicit type conversions. All types except Object define immutable values represented directly at the lowest level of the language. We refer to values of these types as primitive values.
Discussions

What is the difference between primitive and non-primitive data types? When are both used? Can you use them synonymously?
You can see what data types are primitives here on MDN: https://developer.mozilla.org/en-US/docs/Glossary/Primitive Technically, the differences can be subtle, but the big difference is that primitives are immutable, meaning you can't add to or modify properties within them like you can with objects. While you can have objects that are also immutable, primitives are always immutable. If you ever need to change a primitive value, it always has to be reassigned. It can't be modified. Primitives also generally represent a low-level value, not something complex. Things like numbers, strings and booleans make up primitives while more complex types like Dates and Arrays are defined by objects. Most primitives also have object variations of themselves. For example you can have the primitive number 5 or the number object new Number(5). However, you should almost always avoid the object version of primitive types and stick to using their primitive values. More on reddit.com
🌐 r/learnjavascript
4
1
April 11, 2023
Everything in JavaScript is an object...what about primitive data types?
Primitives are not objects. When you call a method on them they are temporarily wrapped in an object and unwrapped when the method is executed. More on reddit.com
🌐 r/learnjavascript
36
57
June 11, 2022
Confusion between Objects and primitive data types in Js
Now, cat is a variable of data type of object, and the object data represents the different key/value pairs (propreties), or the cat is an object? It's the same thing. Technically cat is a variable, and it holds an object (to be even more technical, it holds a reference to an object, but that's not the point). Saying "cat is an object" is a fairly common colloquial way to describe a variable and its type. For instance... let x = 1; I might say "x is a number". It's actually a variable that holds a number, but programmers are going to understand that's what I meant. More on reddit.com
🌐 r/learnprogramming
5
1
May 6, 2022
If string is a primitive then why does it list a bunch of methods when I print out it's prototype?
Same docs answer this question imo: Most of the time, a primitive value is represented directly at the lowest level of the language implementation. All primitives are immutable; that is, they cannot be altered. It is important not to confuse a primitive itself with a variable assigned a primitive value. The variable may be reassigned to a new value, but the existing value can not be changed in the ways that objects, arrays, and functions can be altered. The language does not offer utilities to mutate primitive values. Primitives have no methods but still behave as if they do. When properties are accessed on primitives, JavaScript auto-boxes the value into a wrapper object and accesses the property on that object instead. For example, "foo".includes("f") implicitly creates a String wrapper object and calls String.prototype.includes() on that object. This auto-boxing behavior is not observable in JavaScript code but is a good mental model of various behaviors — for example, why "mutating" primitives does not work (because str.foo = 1 is not assigning to the property foo of str itself, but to an ephemeral wrapper object). More on reddit.com
🌐 r/learnjavascript
9
10
November 13, 2022
🌐
DEV Community
dev.to › mrizwanashiq › primitive-and-non-primitive-56n8
Primitive and Non-primitive - DEV Community
June 8, 2023 - Primitive data types such as string, number, null, undefined, and boolean, are passed by value while non-primitive data types such as objects, arrays, and functions are passed by reference.
🌐
W3Schools
w3schools.com › js › js_datatypes.asp
JavaScript Data Types
In the first example, JavaScript treats 16 and 4 as numbers, until it reaches "Volvo". In the second example, since the first operand is a string, all operands are treated as strings. JavaScript has dynamic types. This means that the same variable can be used to hold different data types:
🌐
Edureka
edureka.co › blog › data-types-in-javascript
What are the Different Data Types in JavaScript - Edureka
February 11, 2025 - Primitive data types are number, string, boolean, NULL, Infinity and symbol. Non-primitive data types is the object. The JavaScript arrays and functions are also objects.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Glossary › Primitive
Primitive - Glossary | MDN
In JavaScript, a primitive (primitive value, primitive data type) is data that is not an object and has no methods or properties. There are 7 primitive data types:
🌐
Medium
medium.com › @dulshansagara6 › lesson-04-understanding-non-primitive-data-types-in-javascript-75f9997283db
Lesson 04: Understanding Non-Primitive Data Types in JavaScript | by Dulshan Senadheera | Medium
July 13, 2024 - Unlike primitive types, which store actual values, non-primitive types store references to the values. This means that when you manipulate a non-primitive type, you’re working with a reference to the original value, not a copy.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-data-types
JavaScript Data Types - GeeksforGeeks
The largest number that JavaScript can reliably represent with the Number primitive is 253, which is represented by the MAX_SAFE_INTEGER constant. ... The data types that are derived from primitive data types are known as non-primitive data types.
Published   January 19, 2026
🌐
FlatCoding
flatcoding.com › tutorials › javascript › data-types-in-javascript-primitive-and-non-primitive
Data Types in JavaScript: Primitive and Non-Primitive
June 23, 2025 - JavaScript archives provide you with a list of articles to help you develop skills. Click here to see more articles with examples.
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › javascript fundamentals
Data types
July 9, 2024 - All other types are called “primitive” because their values can contain only a single thing (be it a string or a number or whatever). In contrast, objects are used to store collections of data and more complex entities.
🌐
Programiz
programiz.com › javascript › data-types
JavaScript Data Types (with Examples)
String, Number, BigInt, Boolean, undefined, null, and Symbol are primitive data types. Non-Primitive Data Types: They can hold multiple values. Objects are non-primitive data types. A string represents textual data. It contains a sequence of characters. For example, "hello", "JavaScript", etc.
🌐
Hyperskill
hyperskill.org › university › javascript › javascript-data-types
JavaScript Data Types
July 22, 2024 - Non-primitive data types are mutable and are stored by reference. For example, an object variable would store a reference to the location in memory where the object's data is stored. Each data type has its unique attributes and is used for different purposes in JavaScript.
🌐
Medium
medium.com › @idineshgarg › primitive-vs-non-primitive-data-types-in-javascript-f3a979ff43e8
Primitive VS Non-Primitive Data types in Javascript | by idineshgarg | Medium
June 12, 2022 - For more details about it, you can refer to the below link. ... In primitive data types, if assigned another value, their reference always changes, but the same does not happen in the concept of non-primitives.
🌐
Quora
quora.com › What-is-the-primitive-and-non-P-data-type-in-JavaScript
What is the primitive and non-P data type in JavaScript? - Quora
Answer: JavaScript provides different data types to hold different types of values. There are two types of data types in JavaScript: 1. Primitive values 2. Non-primitive values (object references) Data types that are known as primitive values in JavaScript are numbers, strings, booleans, null, u...
🌐
Wikipedia
en.wikipedia.org › wiki › Primitive_data_type
Primitive data type - Wikipedia
2 weeks ago - Notations are used to embed non-XML data types. This type cannot be used directly - only derived types that enumerate a limited set of QNames may be used. In JavaScript, there are 7 primitive data types: string, number, bigint, boolean, symbol, undefined, and null.
🌐
JavaScript Tutorial
javascripttutorial.net › home › javascript tutorial › javascript data types
JavaScript Data Types
November 15, 2024 - The following example uses the ... JavaScript (javascript) JavaScript has the primitive types: number, string, boolean, null, undefined, symbol and bigint and a complex type: object....
🌐
Reddit
reddit.com › r/learnjavascript › everything in javascript is an object...what about primitive data types?
r/learnjavascript on Reddit: Everything in JavaScript is an object...what about primitive data types?
June 11, 2022 -

I learned that everything in JS is an object and at first, I assumed this meant EVERYTHING.

This idea made complete sense when I considered all the build-in methods of both primitive data types and reference data types. I also understand that primitive data types are stored in global/local memory and reference data types are stored in the heap. But I was recently told that primitive data types aren't objects which is why they are stored in global memory vs the heap.

If primitive data types aren't objects, how do they have built-in methods that are called upon them?

Furthermore, if I was given the wrong info, and primitive data types are in fact objects, what do their key-value pairs look like under the hood. I should add I understand the key-values pairs of normal objects, arrays, and functions. If strings were objects, I would assume their key-value pair would be like arrays but then I am totally lost when it comes to numbers and Boolean values.

Can someone help explain what I am clearly missing? I have scoured the net and asked other devs but so far no one seems to know.

EDIT - Thank you to everyone who replied. I now have a deeper understanding, new words to google, and more resources to read.

Top answer
1 of 9
40
Primitives are not objects. When you call a method on them they are temporarily wrapped in an object and unwrapped when the method is executed.
2 of 9
30
Each value in JavaScript is either a primitive value or an object. Primitive values are ( see ECMAScript language specification ): undefined null booleans numbers bigints symbols strings All other values are objects. In practice, there are not many differences between primitive values and objects. The main ones are: Primitive values are compared by value, immutable by default, normally categorized via typeof Objects are compared by reference, mutable by default, normally categorized via instanceof All primitive types (except for the types of undefined and null) have associated wrapper classes: Booleans have the wrapper class Boolean. Numbers have the wrapper class Number. Etc. These wrapper classes have two main purposes: First, when called as functions, they convert values to their primitive types: > Number('123') 123 Second, they provide properties for primitive values: > 1.5.toString === Number.prototype.toString true Internally, the language specification temporarily wraps primitive values in order to look up properties. However, implementations can optimize looking up primitive properties and avoid or delay wrapping. Wrapping means invoking the constructor of the wrapper class: > typeof 'abc' // string (primitive value) 'string' > typeof new String('abc') // wrapped string (object) 'object' > typeof 123 // number (primitive value) 'number' > typeof new Number(123) // wrapped number (object) 'object' If we invoke a method on a primitive value p, then this is p in strict mode and a wrapped version of p in non-strict mode: String.prototype.getStrictThis = function () { 'use strict'; return this; }; // We use `new Function` to ensure that this code is in non-strict mode String.prototype.getSloppyThis = new Function(` return this; `); console.log(typeof 'abc'.getStrictThis()); // 'string' console.log(typeof 'abc'.getSloppyThis()); // 'object' If you want to read more about how exactly wrapper classes provide methods for primitive values, you can read this blog post where I explore the language specification: https://2ality.com/2022/03/properties-of-primitives.html
🌐
W3Schools
w3schools.com › java › java_data_types_non-prim.asp
Java Non-Primitive Data Types
Java Examples Java Videos Java Compiler Java Exercises Java Quiz Java Code Challenges Java Server Java Syllabus Java Study Plan Java Interview Q&A Java Certificate ... Non-primitive data types are called reference types because they refer to objects. The main differences between primitive and non-primitive data types are: