Various Data types in Java Script

 

JavaScript data types define the type of data that a variable can hold. They are mainly divided into two categories:

 

1. Primitive Data Types

These are basic data types:

  • Number: Represents numeric values (e.g., 10, 3.14)

  • String: Represents text (e.g., "Hello")

  • Boolean: Represents logical values (true or false)

  • Undefined: A variable declared but not assigned a value

  • Null: Represents an empty or unknown value

 

2. Non-Primitive (Reference) Data Types

These store collections of data:

  • Object: Collection of key-value pairs

    Example: {name: "Rikki", age: 18}

  • Array: Ordered list of values

    Example: [1, 2, 3]

  • Function: Block of code designed to perform a task

  • BigInt: Used for very large integers

  • Symbol: Represents unique identifiers