๐ŸŒ
MDN Web Docs
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Glossary โ€บ Primitive
Primitive - Glossary | MDN
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). ... This page was last modified on Jul 11, 2025 by MDN contributors. View this page on GitHub โ€ข Report a problem with this content
๐ŸŒ
GitHub
gist.github.com โ€บ branneman โ€บ 7fb06d8a74d7e6d4cbcf75c50fec599c
Primitive Types & Reference Types in JavaScript ยท GitHub
The in-memory value of a primitive type is it's actual value (e.g. boolean true, number 42). A primitive type can be stored in the fixed amount of memory available. ... Primitive types are also known as: scalar types or simple types.
๐ŸŒ
W3Schools
w3schools.com โ€บ js โ€บ js_datatypes.asp
JavaScript Data Types
JS Data Types JS Primitive Data JS Object Types JS typeof JS toString() JS Type Conversion JS Errors
๐ŸŒ
GitHub
gist.github.com โ€บ dwivediamit โ€บ 4152f126deedab69b7c2050d38883f44
JavaScript primitive types.md ยท GitHub
There are 7 primitive data types: string, number, bigint, boolean, undefined, symbol, and null.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ primitive-and-non-primitive-data-types-in-javascript
Primitive and Non-primitive data-types in JavaScript - GeeksforGeeks
Primitive data types are the built-in data types provided by JavaScript. They represent single values and are not mutable.
Published ย  July 23, 2025
๐ŸŒ
GitHub
github.com โ€บ jonschlinkert โ€บ is-primitive
GitHub - jonschlinkert/is-primitive: Is the typeof value a javascript primitive?
The Mozilla docs for "Primitive values" defines specifies six data types that are primitives: Boolean ยท Null ยท Undefined ยท Number ยท String ยท
Starred by 37 users
Forked by 9 users
Languages ย  JavaScript
๐ŸŒ
JavaScript.info
javascript.info โ€บ tutorial โ€บ the javascript language โ€บ data types
Methods of primitives
There are 7 primitive types: string, number, bigint, boolean, symbol, null and undefined.
๐ŸŒ
Suwebdev
suwebdev.github.io โ€บ WATS-3020-gitbook โ€บ data-types โ€บ 54-other-primitive-data-types.html
5.4 Other Primitive Data Types ยท GitBook
JavaScript also gives us a few Data Types that are used in more specific ways: Boolean, Undefined, Null, and Symbols.
Find elsewhere
๐ŸŒ
Edureka
edureka.co โ€บ blog โ€บ data-types-in-javascript
What are the Different Data Types in JavaScript - Edureka
February 11, 2025 - The Primitive Data types in JavaScript include Number, String, Boolean, Undefined, Null and Symbol.
๐ŸŒ
GitConnected
levelup.gitconnected.com โ€บ primitive-vs-non-primitive-value-in-javascript-82030928fd9
Primitive vs Non-Primitive Value in Javascript? | by Ayush Tibra | Level Up Coding
June 15, 2022 - Primitives are known as being immutable data types because there is no way to change a primitive value once it gets created.
๐ŸŒ
web.dev
web.dev โ€บ learn โ€บ javascript โ€บ data-types
Data types and structures | web.dev
Primitives are the simplest types of data in JavaScript. A primitive literal is a value, with no wrapper or properties of its own. Primitive literals are immutable, meaning they can't be changed to represent other values in the same way that ...
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ primitive-vs-reference-data-types-in-javascript
Primitive vs Reference Data Types in JavaScript
January 18, 2022 - Examples of such data types are numbers, strings, booleans, null, and undefined. But you might be wondering about strings, because they do have methods. The fact is, JavaSvript converts primitive strings to string objects, so that it is possible ...
๐ŸŒ
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.
๐ŸŒ
Scaler
scaler.com โ€บ topics โ€บ what-are-the-primitive-data-types-in-javascript
What are the Primitive Data Types in JavaScript? - Scaler Topics
October 27, 2022 - Every programming language has data types that are used for storing values in the variable to perform a logical or mathematical operation. Similarly, we have data types in javascript that can be broadly divided into two groups such as primitive and non-primitive.
๐ŸŒ
Ga-wdi-exercises
ga-wdi-exercises.github.io โ€บ wdi22-javascript-cheatsheets โ€บ primitive_data_types.html
Primitive Data Types | wdi22-javascript-cheatsheets
typeof(10) // this is a number typeof("10") // this is a string "10" === 10 // this will evaluate false because 10 and "10" are not of the same data type "10" == 10 // this will evaluate true because the double == only checks if the value are the same while ignoring data types typeof(NaN) // NaN means 'Not a Number' but it will evaluate as a number.
๐ŸŒ
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
๐ŸŒ
Tutorial Republic
tutorialrepublic.com โ€บ javascript-tutorial โ€บ javascript-data-types.php
Understanding the JavaScript Data Types - Tutorial Republic
There are six basic data types in JavaScript which can be divided into three main categories: primitive (or primary), composite (or reference), and special data types. String, Number, and Boolean are primitive data types. Object, Array, and ...
๐ŸŒ
ScholarHat
scholarhat.com โ€บ home
Data Types in JavaScript: Primitive & Non-Primitive
September 22, 2025 - The eight basic data types in JavaScript are classified into two categories: Primitive data types are predefined or built-in data types in JavaScript that can hold simple values.
๐ŸŒ
33jsconcepts
33jsconcepts.com โ€บ concepts โ€บ primitive-types
Primitive Types - 33 JavaScript Concepts
JavaScript has exactly seven primitive types: string, number, bigint, boolean, undefined, null, and symbol. As defined by the ECMAScript specification, these are the fundamental building blocks of all data in JavaScript โ€” everything else is ...