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 - In JavaScript, we have value types, also called primitives, and reference types (non-primitives) which are objects. Primitives are number, string, boolean, symbol, undefined, and null, whereas, Non-primitives are objects, functions, and arrays.
People also ask

What are the different types of primitive data types in JavaScript?
JavaScript has seven primitive data types: String, Number, Boolean, Undefined, Null, Symbol, and BigInt.
🌐
studysmarter.co.uk
studysmarter.co.uk › javascript primitive data types
Javascript Primitive Data Types: Understanding & Examples
How are JavaScript primitive data types stored in memory?
JavaScript primitive data types, which include numbers, strings, booleans, null, undefined, and symbols, are stored directly in the stack, because they are immutable and have a fixed size. This allows for efficient access and manipulation as they are stored by value.
🌐
studysmarter.co.uk
studysmarter.co.uk › javascript primitive data types
Javascript Primitive Data Types: Understanding & Examples
What are the differences between primitive data types in JavaScript and other programming languages?
In JavaScript, primitive data types include undefined, null, boolean, number, string, symbol, and bigint, and are immutable. Unlike some other languages, JavaScript treats null and undefined as distinct types. Additionally, JavaScript's dynamic typing allows primitives to be easily converted between types, whereas other languages might require explicit conversions. Some programming languages also include a wider range of primitive types, such as integer or character types, which JavaScript doesn't differentiate independently.
🌐
studysmarter.co.uk
studysmarter.co.uk › javascript primitive data types
Javascript Primitive Data Types: Understanding & Examples
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.

🌐
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) ...
🌐
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
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.
Find elsewhere
🌐
StudySmarter
studysmarter.co.uk › javascript primitive data types
Javascript Primitive Data Types: Understanding & Examples
Examples of Javascript Primitive ... Non-Primitive Types: Primitive types hold actual values and are compared by value, while non-primitive-types (reference types) like objects and arrays are mutable, hold references, and are compared by reference....
🌐
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.
🌐
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 › @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 all the primitive data types, you can assign a specified typed value, the same is not in the case of non-primitives. Let us make it more clear with some examples. ... Let us consider a variable assigned a value of a string, now if I add ...
🌐
Medium
medium.com › @junshengpierre › javascript-primitive-values-object-references-361cfc1cbfb0
JavaScript: Primitive Values & Object References | by Teo Jun Sheng, Pierre | Medium
June 23, 2022 - Data types that are known as primitive values in JavaScript are numbers, strings, booleans, null, undefined. Objects such as functions and arrays are referred to as non-primitive 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 - ... Non-Primitive:- Object (array, functions) also called object references. The fundamental difference between primitives and non-primitive is that primitives are immutable and non-primitive are mutable.
🌐
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 - We can access individual elements of the array using the index number. For example, fruits[0] would return "apple". Dates are a built-in non-primitive data type in JavaScript. They are used to represent dates and times, and can be created using the Date constructor.
🌐
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 ...
🌐
Medium
medium.com › @hak.hakobian › primitive-and-non-primitive-data-types-in-javascript-66ca8f430102
Primitive and Non-Primitive Data Types in JavaScript | by Hakob Hakobyan | Medium
February 17, 2025 - Non-primitive data types, on the other hand, are more complex and can store collections of values or multiple properties. They include: Object: A collection of key-value pairs. Array: An ordered list of values.
🌐
CodeSweetly
codesweetly.com › javascript-non-primitive-data-type
Non-primitive Data Type – What Is a JavaScript Object? | CodeSweetly
A non-primitive data is a JavaScript value that can contain multiple other values. Object is the only non-primitive data that exist in JavaScript.
🌐
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.
🌐
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 - Above is an example of how we can take a non-primitive data type and break it down into a primitive type. We are initializing birds and setting it to an array (non-primitive) of birds breeds. From here, we are able to run the map method, which loops over each value in the bird array.