Number, String, Undefined, null, Boolean.
In JavaScript, there are several data types that are supported. They include:
- Primitive Data Types:
- String: Represents textual data, e.g., “hello”.
- Number: Represents numeric values, e.g., 42.
- Boolean: Represents true or false values.
- Undefined: Represents a variable that has been declared but not assigned a value.
- Null: Represents the intentional absence of any object value.
- Symbol (added in ECMAScript 6): Represents unique identifiers.
- Non-primitive Data Types (also known as Reference Data Types):
- Object: Represents a collection of key-value pairs.
- Array: A special type of object used to store ordered collections of data.
- Function: A callable object that can be invoked.
- Date: Represents a specific moment in time.
- RegExp: Represents a regular expression pattern.
- Object: Represents a collection of key-value pairs.
These are the primary data types in JavaScript. It’s essential to understand each of them and their respective use cases for effective JavaScript programming.