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 ... and Non-Primitive Data Types. Let us discuss it one by one. Primitive data types are the built-in data types provided by JavaScript. They represent single values and are not mutable. JavaScript supports the following primitive data types: Number data type in JavaScript can be used to hold decimal values as well as values without decimals. Example: Below is ...
Published   July 23, 2025
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Glossary › Primitive
Primitive - Glossary | MDN
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.
People also ask

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
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 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
🌐
DEV Community
dev.to › mrizwanashiq › primitive-and-non-primitive-56n8
Primitive and Non-primitive - DEV Community
June 8, 2023 - In the above example, we have created an object named person and assigned the value { name: 'Rizwan', age: 25 } to it. Then, we have tried to change the value of the name property to 'rizwan' using the dot notation.
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.

🌐
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) ...
Find elsewhere
🌐
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.
🌐
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.
🌐
freeCodeCamp
freecodecamp.org › news › primitive-vs-reference-data-types-in-javascript
Primitive vs Reference Data Types in JavaScript
January 18, 2022 - These data types are pretty simple, ... not objects, and do not have methods. Examples of such data types are numbers, strings, booleans, null, and undefined....
🌐
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. Example1:- ... It’s important to note in the above example that a variable that stored primitive value can be reassigned to a new value as shown in the above example but the existing value can’t be changed as shown below:- ... A primitive value can be replaced, but it can’t be directly altered.
🌐
TutorialsPoint
tutorialspoint.com › what-are-primitive-and-non-primitive-data-types-in-javascript
What are Primitive and Non-Primitive Data Types in ...
The Symbol data type is introduced in the ES6 version of JavaScript. It is used to create unique primitive, and immutable values. The Symbol() constructor can be used to create a unique symbol, and you may pass the string as a parameter of the Symbol() constructor. In the example below, we created the sym1 and sym2 symbols for the same string.
🌐
Scaler
scaler.com › home › topics › what are non-primitive data types in javascript?
Non-primitive data types in Javascript | Scaler Topics
May 4, 2023 - 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 using attributes and methods.
🌐
Medium
medium.com › @gourabb68 › primitive-vs-non-primitive-data-type-in-javascript-6419aaecd96c
Primitive vs Non-Primitive data type in JavaScript | by Gourab Banerjee | Medium
July 19, 2020 - In the above example we cannot modify the content of name because it has fixed size of memory and that has allocated at the compile time. Non — primitive follows the technique of Dynamic Memory Allocation where memory allocation is not fixed and it depends on the content. It is stored in HEAP memory so it is slow compare to primitive datatype and known as being mutable data types means we can change or increase its content.
🌐
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:
🌐
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 - Arrays are another common non-primitive data type in JavaScript that are used to store ordered collections of data in a single variable. They can be created using the square brackets [] syntax. Arrays can contain any data type, and the elements are indexed by number starting from 0. ... We can access individual elements of the array using the index number. For example, fruits[0] would return "apple".
🌐
Mozilla
developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Data_structures
JavaScript data types and data structures - JavaScript | MDN
All primitive types, except null and undefined, have their corresponding object wrapper types, which provide useful methods for working with the primitive values. For example, the Number object provides methods like toExponential(). When a property is accessed on a primitive value, JavaScript ...
🌐
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.
🌐
ScholarHat
scholarhat.com › home
Data Types in JavaScript: Primitive & Non-Primitive
September 22, 2025 - They are: Strings in JavaScript are a sequence of characters surrounded by quotes, single(' '), double(" "), or backticks (` `) representing textual data. For example, 'ScholarHat', "ScholarHat", `ScholarHat`.