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
Answer from Sudipta Kumar Maiti on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › primitive-and-non-primitive-data-types-in-javascript
Primitive and Non-primitive data-types in JavaScript - GeeksforGeeks
Below is a list of Non-primitive data types. An object in Javascript is an entity having properties and methods.
Published   July 23, 2025
🌐
Scaler
scaler.com › topics › non-primitive-data-types-in-javascript
Non-primitive data types in Javascript | Scaler Topics
November 15, 2022 - Objects in JavaScript are referred to as non-primitive data types in JavaScript. These data types are derived from JavaScript’s primitive data types.
People also ask

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
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
🌐
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 - 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.
🌐
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 › imashwani › javascript-non-primitive-data-types-2mjp
JavaScript Non-Primitive Data Types - DEV Community
April 2, 2024 - Non-primitive data types in JavaScript are derived from the primitive data types and are also known as reference data types or derived data types.
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
🌐
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 - All JavaScript values, except primitives, are objects. Mutable values are those which can be modified after creation Immutable values are those which cannot be modified after creation · So the fundamental 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) are stored by reference.
🌐
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 - Lesson 04: Understanding Non-Primitive Data Types in JavaScript In JavaScript, while primitive data types form the foundation, non-primitive data types allow for more complex data structures and are …
🌐
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.
🌐
W3Schools
w3schools.com › js › js_datatypes.asp
JavaScript Data Types
Booleans are often used in conditional testing. ... JavaScript Objects represent complex data structures and functionalities beyond the primitive data types (string, number, boolean, null, undefined, symbol, bigint).
🌐
TutorialsPoint
tutorialspoint.com › what-are-primitive-and-non-primitive-data-types-in-javascript
What are Primitive and Non-Primitive Data Types in ...
One of the most fundamental characteristics of a programming language is the set of data types it supports. These are the type of values that can be represented and manipulated in a programming language. JavaScript data types can be categorized as primitive and non-primitive (object).
🌐
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.
🌐
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 - This is a common confusion among developers who assume that arrays are a special data type in Javascript. Now, these data types are broadly classified into 2 types: Primitive:- (String,Boolean,Number,BigInt,Null,Undefined,Symbol ) Non-Primitive:- Object (array, functions) also called object ...
🌐
MSR
rajamsr.com › home › top 6 non primitive data types in javascript
Top 6 Non Primitive Data Types In JavaScript | MSR - Web Dev Simplified
February 29, 2024 - Discover the non primitive data types in JavaScript, including Arrays, Maps, Sets, WeakMaps, and WeakSets with examples.
🌐
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. ... Beyond the core questions, let’s consider additional aspects that deepen our understanding of JavaScript datatypes...
🌐
ScholarHat
scholarhat.com › home
Data Types in JavaScript: Primitive & Non-Primitive
September 22, 2025 - 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 and are derived from primitive ones.
🌐
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:
🌐
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.