Data Types are made on the basis of how data are stored and how it is accessed.

  1. Primitive Data Types: | (Call By Value ⇒ Changes are made in Copy)

    Total 7 Data Types in Primitive Classification.

  2. Non-Primitive (Reference) Data Type: | (Call By Reference ⇒ Changes in the Original Values)


1. Primitive Data Types

These are the most basic data types in JavaScript.

Characteristics:

Types:

  1. Number: Represents numerical values, both integers and floating-point numbers.

    let age = 25;
    let price = 99.99;
    
    
  2. String: Represents textual data, enclosed in single (') or double (") quotes or backticks (`).

    let name = "John";
    
    
  3. Boolean: Represents true or false.

    let isLoggedIn = true;
    
    
  4. Undefined: A variable that has been declared but not assigned a value.

    let x;
    console.log(x); // undefined
    
    
  5. Null: Represents an explicitly empty or unknown value.

    let data = null;
    
    
  6. Symbol: Introduced in ES6, used to create unique identifiers.

    let sym = Symbol("id");
    
    
  7. BigInt: For numbers larger than 2^53 - 1 (safe integer limit).

    let bigNumber = 123456789012345678901234567890n;
    
    

2. Non-Primitive Data Types