JavaScript Data Types
Primitive Data Types and Non Primitive Data Types
Data types in JavaScript define the type of data that a variable can store.
JavaScript has several built-in data types, which can be categorized into two main groups: Primitive Types and Non primitive (Reference Types) (Objects).
Primitive Data Types:
These data types represent a single value. They are immutable (cannot be changed) and are stored by value.
These data types represent a single value. They are immutable (cannot be changed) and are stored by value.
- String: Represents a sequence of characters enclosed in quotes (
' '," ", or``). 
- Number: Represents both integer and floating-point numbers.
 
- Boolean: Represents true or false.
 
- Undefined: A variable that has been declared but not yet assigned a value.
 
- Null: Represents an intentional absence of any value.
 
- Symbol (ES6): A unique and immutable value, typically used as object property keys.
 
Non Primitive Data Types:
Non-primitive data types are also known as reference types. These types are not directly stored by value but by reference.
- Object: Objects are collections of key-value pairs.
 
- Array: Array used to store ordered lists of values.
 
- Function: Functions can be assigned to variables, passed as arguments, and returned from other functions.