What are JavaScript data types?
Answer:
JavaScript has the following data types:
1. Primitive Types (Immutable):
- String: Textual data ("hello")
- Number: Integers and floating-point numbers (42, 3.14)
- Boolean: Logical values (true, false)
- Undefined: A variable that has been declared but not assigned a value.
- Null: Represents an intentional absence of value.
- BigInt: For numbers larger than Number.MAX_SAFE_INTEGER.
- Symbol: Unique and immutable value.
2. Non-Primitive Type (Mutable):
Object: Collection of key-value pairs (e.g., { key: "value" }
).