What are the data types in JavaScript?

JavaScript has 7 primitive types and the object type.

TypeExample
String"Hello"
Number42, 3.14
Booleantrue
UndefinedA variable without a value
NullAn empty value on purpose
BigInt10n
SymbolA unique identifier
ObjectArrays, 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

See JavaScript Data Types.


Learn more about the similar topics:
Tutorials
JavaScript Variables
JavaScript Scope
JavaScript Data Types
JavaScript Type Conversion
JavaScript Operators
JavaScript Numbers and Math
Exercises & Assignments
Write a JavaScript program to add two numbers
Write a JavaScript program to swap two variables
Interview Questions & Answers
What are the data types in JavaScript?
What is the difference between == and === in JavaScript?
What is NaN in JavaScript?
What is the difference between null and undefined?
What is scope in JavaScript?
What is the difference between var, let and const?
What is hoisting in JavaScript?