๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ primitive-and-non-primitive-data-types-in-javascript
Primitive and Non-primitive data-types in JavaScript - GeeksforGeeks
Non-primitive data types, also known as reference types, are objects and derived data types. They can store collections of values or more complex entities. The two key non-primitive data types in JavaScript are:
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 types of primitive data types in JavaScript?
JavaScript has seven primitive data types: String, Number, Boolean, Undefined, Null, Symbol, and BigInt.
๐ŸŒ
vaia.com
vaia.com โ€บ 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.
๐ŸŒ
vaia.com
vaia.com โ€บ javascript primitive data types
Javascript Primitive Data Types: Understanding & Examples
How do JavaScript primitive data types differ from reference types?
JavaScript primitive data types are immutable and stored by value, meaning each variable holds its own data copy. Reference types, like objects and arrays, are mutable and stored by reference, meaning variables point to the actual data location, allowing shared and modified data across different references.
๐ŸŒ
vaia.com
vaia.com โ€บ javascript primitive data types
Javascript Primitive Data Types: Understanding & Examples
๐ŸŒ
Mozilla
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Web โ€บ JavaScript โ€บ Guide โ€บ Data_structures
JavaScript data types and data structures - JavaScript | MDN
For instance, with a separator, one could emulate a list (while a JavaScript array would be more suitable). Unfortunately, when the separator is used in one of the "list" elements, then, the list is broken. An escape character can be chosen, etc. All of this requires conventions and creates an unnecessary maintenance burden. Use strings for textual data. When representing complex data, parse strings, and use the appropriate abstraction. A Symbol is a unique and immutable primitive value and may be used as the key of an Object property (see below).
๐ŸŒ
W3Schools
w3schools.com โ€บ js โ€บ js_datatypes.asp
JavaScript Data Types
In the first example, JavaScript treats 16 and 4 as numbers, until it reaches "Volvo". In the second example, since the first operand is a string, all operands are treated as strings. JavaScript has dynamic types. This means that the same variable can be used to hold different data types:
๐ŸŒ
DEV Community
dev.to โ€บ mrizwanashiq โ€บ primitive-and-non-primitive-56n8
Primitive and Non-primitive - DEV Community
June 8, 2023 - Primitives are number, string, boolean, symbol, undefined, and null, whereas, Non-primitives are objects, functions, and arrays. In pass-by value in JavaScript, a copy of the original variable is created, so any changes made to the copied variable ...
๐ŸŒ
Edureka
edureka.co โ€บ blog โ€บ data-types-in-javascript
What are the Different Data Types in JavaScript - Edureka
February 11, 2025 - There are seven primitive data types, Number, String, Boolean, NULL, Undefined and Symbol and one non-primitive data type โ€˜objectโ€™. There are differences between NULL and undefined data types though both contain the same value.
๐ŸŒ
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.
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
๐ŸŒ
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:
๐ŸŒ
ScholarHat
scholarhat.com โ€บ home
Data Types in JavaScript: Primitive & Non-Primitive
September 22, 2025 - The ES6 version introduced in 2015 ... are classified into two categories: Primitive data types are predefined or built-in data types in JavaScript that can hold simple values....
๐ŸŒ
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 - In primitive data types, if assigned another value, their reference always changes, but the same does not happen in the concept of non-primitives.
๐ŸŒ
Programiz
programiz.com โ€บ javascript โ€บ data-types
JavaScript Data Types (with Examples)
Primitive Data Types: They can hold a single simple value. String, Number, BigInt, Boolean, undefined, null, and Symbol are primitive data types. Non-Primitive Data Types: They can hold multiple values.
๐ŸŒ
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.
๐ŸŒ
W3Schools
w3schools.com โ€บ js โ€บ js_datatypes_primitives.asp
JavaScript Primitive Data Types
An empty string has both a legal value and a type. let car = ""; // The value is "", the typeof is "string" Try it Yourself ยป ยท In JavaScript, a variable or an expression can obtain the datatype null in several ways.
๐ŸŒ
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 - Primitive and Non-Primitive Data Types in JavaScript Primitive Data Types String: Textual data Number: Numeric values Boolean: Logical values Null: Represents an intentional absence of any object โ€ฆ
๐ŸŒ
Assisihospital
assisihospital.com โ€บ 2jxua โ€บ primitive-and-non-primitive-data-types-in-javascript-w3schools
primitive and non primitive data types in javascript w3schools
Primitive data types can only be one size. W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Non-primitive types are created by the programmer and is not defined by Java (except for String ). JavaScript Data Types - W3Schools You can use ...
๐ŸŒ
JavaScript.info
javascript.info โ€บ tutorial โ€บ the javascript language โ€บ javascript fundamentals
Data types
All other types are called โ€œprimitiveโ€ because their values can contain only a single thing (be it a string or a number or whatever).