1. JavaScript Data Types

🧠JavaScript Data Types

What is a Data Type?

🧩 Basic Data Types in JavaScript

1. Number

2. String

3. Boolean

4. undefined

5. null

6. Object

7. Symbol

8. BigInt

🧾 Summary

Data Type Example Description Real-World Use
Number let price = 499.99; Represents numeric values (integers or decimals) Tracking a product’s price, temperature, or age
String let name = "John Doe"; Text or sequence of characters Storing usernames, messages, or display text
Boolean let isOnline = true; Logical value: true or false Checking if a user is logged in, dark mode on/off
undefined let phone; Declared but not assigned a value Variable waiting for user input or API data
null let selectedItem = null; Empty on purpose — no value yet Resetting variables or clearing form fields
Object let user = { name: "Liya", age: 20 }; Group of related data (key-value pairs) Representing user profiles, products, cars, etc.
Symbol const token = Symbol('id'); Unique identifier, never duplicated Creating private keys or unique property names
BigInt let bigNum = 98765432109876543210n; Very large integers beyond normal Number limit Handling financial data, scientific calculations