JavaScript Data Types

JavaScript encompasses a rich assortment of data types that empower developers to manipulate and organize various kinds of information. These data types can be categorized into primitive types and reference types.

Primitive Data Types

These data types are fundamental and immutable, representing basic values directly.


This data type covers both integers and floating-point numbers. Examples:

let integer = 42; let float = 3.14;


Strings represent sequences of characters, enclosed in single or double quotes. Examples:

let message = "Hello, world!"; let name = 'Alice';


Booleans have two possible values: true or false. They're used for logical operations and conditions. Examples:

let isTrue = true; let isFalse = false;


When a variable is declared but not assigned a value, it holds the undefined type. Example:

let uninitializedVar;


The null type signifies an intentional absence of value. Example:

let noValue = null;

Symbol (ES6)

Symbols are unique and often used as object property identifiers to prevent naming conflicts. Example:

const uniqueKey = Symbol('unique');

Reference Data Types

These data types are more complex and can hold multiple values and methods. They are mutable, meaning their content can be modified.


Objects are collections of key-value pairs, where keys are strings or symbols and values can be of any data type. Examples:

let person = { name: "John", age: 30, isStudent: false };


Arrays are ordered lists of values, indexed starting from zero. They can hold different data types. Examples:

let colors = ["red", "green", "blue"]; let mixedArray = [42, "apple", true];


Functions are reusable blocks of code that can be executed when called. Example:

function greet(name) { return `Hello, ${name}!`; }


The Date type is used to work with dates and times. Example:

let currentDate = new Date();


Regular expressions are used for pattern matching within strings. Example:

let pattern = /[a-z]+/;


JavaScript's diverse array of data types provides the foundation for creating intricate and efficient programs, enabling developers to manage different kinds of data and perform various operations.