What are the data types in JavaScript?
JavaScript has 7 primitive types and the object type.
| Type | Example |
|---|---|
| String | "Hello" |
| Number | 42, 3.14 |
| Boolean | true |
| Undefined | A variable without a value |
| Null | An empty value on purpose |
| BigInt | 10n |
| Symbol | A unique identifier |
| Object | Arrays, functions, dates and plain objects |
console.log(typeof "hi", typeof 5, typeof true, typeof undefined, typeof {});
Output:
Tutorials Class - Output Window
string number boolean undefined object
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |