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
🌐
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.
People also ask

How many data types are there in JavaScript?
There are two main data types in JavaScript: Primitive and Non-Primitive. Primitive data types include seven types: String, Number, Boolean, Null, Undefined, BigInt, and Symbol, while non-primitive types include Object, Array, and Function.
🌐
wscubetech.com
wscubetech.com › resources › javascript › data-types
JavaScript Data Types: Primitive & Non-Primitive With Examples
What are the different data types in JavaScript?
There are two major types of data types in JS:Primitive: String, Number, Null, Boolean, Undefined, BigInt, and SymbolNon-primitive: Object, Array, Function
🌐
wscubetech.com
wscubetech.com › resources › javascript › data-types
JavaScript Data Types: Primitive & Non-Primitive With Examples
What are data types in JavaScript?
Data types in JavaScript define the kind of values you can store and use in a program. They help you manage and perform operations on different kinds of data efficiently.
🌐
wscubetech.com
wscubetech.com › resources › javascript › data-types
JavaScript Data Types: Primitive & Non-Primitive With Examples
🌐
WsCube Tech
wscubetech.com › resources › javascript › data-types
JavaScript Data Types: Primitive & Non-Primitive With Examples
November 5, 2025 - Learn about JavaScript data types: Primitive & Non-Primitive with examples. Explore strings, numbers, objects, arrays, and more in this comprehensive guide.
🌐
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.
🌐
DEV Community
dev.to › js_catch › 02-primitive-and-non-primitive-data-types-in-javascript-2dhd
02 - Primitive and Non-Primitive Data Types in Javascript - DEV Community
July 2, 2020 - Mutable values are those which ... difference between primitive and non-primitive is that primitive values are immutable and non-primitive values are mutable and Primitives are stored by value while Non-Primitive (objects) ...
Top answer
1 of 7
4
Data Types (JavaScript):

Primary Data Types
The primary (primitive) data types are:
String, Number, Boolean

Composite Data Types
The composite (reference) data types are:
Object, Array

Special Data Types
The special data types are:
Null, Undefined

Click here for details:

  var test1 = 1;
  var test2 = "Something";
  var test3 = true;
  var test4 = {};
  var test5 = new Array();
  var test6 = new Date();
  var test7;
  var test8 = null;

  alert(typeof (test1)); //number
  alert(typeof (test2)); //string
  alert(typeof (test3)); //boolean
  alert(typeof (test4)); //object
  alert(typeof (test5)); //object
  alert(typeof (test6)); //object
  alert(typeof (test7)); //undefined
  alert(typeof (test8)); //object
2 of 7
4

Javascript has five primitive data types: 1. number 2. string 3. boolean 4. undefined 5. null

Anything that doesn’t belong to any of these five primitive types is considered an object.

First 3 data types has a corresponding object constructor. For example

var word = "something";

And then as an object:

 var word = new String("something");

For object constructor notice the new keyword. It creates object reference.

Another thing to notice that

var greeting = "something";
var word = new String("something");
greeting == word ----> True as their value is same
greeting === word -----> False because there value same but type is different .

As for var keyword being same for all the cases,remember that Javascript is dynamically typed language. That means it resolves data type checking during runtime rather than compile time(like Java, C++ ).

This makes javascript extremely powerful. Though this unique feature has drawback too. Please co through this wikipedia for details: https://en.wikipedia.org/wiki/Type_system#Static_and_dynamic_type_checking_in_practice

Hope this helps.

Find elsewhere
🌐
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:
🌐
Devsnest
devsnest.in › blogs › understanding-datatypes-in-javascript-primitive-and-non-primitive
Understanding Datatypes in JavaScript - Primitive and Non-Primitive - Blog | Devsnest
Primitive types are fundamental and immutable, while non-primitive types are more complex and mutable. ... Determining the type of a value in JavaScript is crucial. The typeof operator can be used for this purpose.
🌐
Medium
medium.com › @Harshit_Raj_14 › data-types-in-javascript-d8ea72dd3ca9
Data Types in JavaScript. In JavaScript, data types are broadly… | by Harshit Raj | Medium
March 3, 2023 - Objects are a non-primitive data type, which means that they are made up of other primitive and non-primitive data types, such as strings, numbers, arrays, functions, and even other objects.
🌐
TutorialsPoint
tutorialspoint.com › what-are-primitive-and-non-primitive-data-types-in-javascript
What are Primitive and Non-Primitive Data Types in ...
JavaScript (ES6 and higher) allows you to work with seven primitive data types − · Strings of text e.g. "This text string" etc. Numbers, eg. 123, 120.50 etc. Boolean e.g. true or false. ... BigInt and Symbol are introduced in ES6.
🌐
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.
🌐
Vaia
vaia.com › javascript primitive data types
Javascript Primitive Data Types: Understanding & Examples
Non-Primitive Data Types: Also known as reference types, these include objects, arrays, and functions. They hold references to memory locations, not the actual data values. Consider the following JavaScript code that showcases the difference:
🌐
DEV Community
dev.to › thecharacterv › defining-primitive-and-non-primitive-data-types-in-javascript-40gk
Defining Primitive and Non-Primitive Data Types in JavaScript - DEV Community
January 15, 2021 - Here we are setting favoriteBird equal to birdBreed. When we reassign favoriteBird with a different value, it does not effect the value of birdBreed. This is what we would expect to happen! This is an example showing immutability. You will see later that this is not the case for non-primitive data types.
🌐
Scaler
scaler.com › topics › non-primitive-data-types-in-javascript
Non-primitive data types in Javascript | Scaler Topics
November 15, 2022 - These are also referred to as reference data types or derived data types. Variables of non-primitive data types are stored in the heap memory of the system, while primitive data types variables are stored in the stack space of the system. ... Object: In Javascript, an object is a thing defined ...
🌐
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.
🌐
JavaScript in Plain English
javascript.plainenglish.io › javascript-reviewing-primitive-and-non-primitive-data-types-5bc4ca68c3de
JavaScript: Reviewing Primitive and Non-Primitive Data Types | by Benny Louie | JavaScript in Plain English
March 30, 2022 - The [10] on the left has a different address in memory than the [10] on the left. The equality operator (===) is checking if they are pointing to the same address which is why the result is false. Primitive data types are stored by value. Non-Primitive data types are stored by reference.
🌐
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. Non-Primitive data types in JavaScript can hold multiple values ...
🌐
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 - Now, these data types are broadly ... object references. The fundamental difference between primitives and non-primitive is that primitives are immutable and non-primitive are mutable....