J

JavaScript Handbook

Clean • Professional

JavaScript Data Types Overview

1 minute

JavaScript Data Types Overview

Data type in JavaScript defines the kind of value a variable can hold. It tells the computer how to interpret and use that value, such as numbers, text, true/false, or more complex structures like objects and arrays. In JavaScript, data types are mainly divided into two categories:

  1. Primitive Data Types
  2. Non-Primitive Data Types

learn code with durgesh images

Primitive Data Types

Primitive types are immutable, meaning their values cannot be changed once created. They are stored by value.

  • String
  • Number
  • BigInt
  • Boolean
  • Undefined
  • Null
  • Symbol

Non-Primitive Data Types (Objects)

Reference types are mutable and stored by reference. They include objects, arrays, and functions.

  • Object
  • Array
  • Function

Summary Table

TypeWhat It IsExampleUse Case
NumberNumbers (int, decimal)const x = 42.5;Math, counts
StringTextlet s = "Hi";Names, messages
Booleantrue or falseconst b = true;Conditions
UndefinedNo value setlet u;Missing data
NullIntentional no valueconst n = null;Reset data
SymbolUnique IDconst s = Symbol("id");Unique keys
BigIntHuge integersconst b = 123n;Large numbers
ObjectKey-value pairs, arraysconst o = { key: 1 };Complex data


Article 0 of 0