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
๐ŸŒ
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.
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.

๐ŸŒ
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.
๐ŸŒ
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) ...
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.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ what-are-primitive-and-non-primitive-data-types-in-javascript
What are Primitive and Non-Primitive Data Types in JavaScript?
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.
๐ŸŒ
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.
๐ŸŒ
StudySmarter
studysmarter.co.uk โ€บ 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:
๐ŸŒ
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 ...
๐ŸŒ
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....
๐ŸŒ
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 ...
๐ŸŒ
Masai Learn
masaischool.com โ€บ learn โ€บ tutorials โ€บ javascript-tutorial โ€บ data-types-in-javascript
Masai Learn - Data Types in JavaScript (Primitive & Non-Primitive)
October 14, 2022 - JavaScript has primitive data types like strings, numbers, booleans, undefined, and null & non-primitive data types like arrays and objects.
๐ŸŒ
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...
๐ŸŒ
CodeSweetly
codesweetly.com โ€บ javascript-non-primitive-data-type
Non-primitive Data Type โ€“ What Is a JavaScript Object? | CodeSweetly
Object is the only non-primitive data that exist in JavaScript. But what exactly is a JavaScript object?
๐ŸŒ
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.