Data Types in JavaScript
A common warmup question during technical interviews is to name the different data types in JavaScript. Do you know all of them? By data types, we simply mean the type of value in JavaScript. For example, the following data type is a string:
// The type od `data` is a string
const data = 'type';
// We can verify that by using `typeof`
// This will return "string"
typeof data;
We can verify that by using the typeof
operator on it. We can separate data types into two different categories:
- Primitives
- Complex
The latest ECMAScript standard defines nine different data types, from which seven are primitives and two are complex. In order theses are:
Primitive data types
Complex data types
Resources:
Rocket Launch Your Career
Speed up your learning progress with our mentorship program. Join as a mentee to unlock the full potential of Webtips and get a personalized learning experience by experts to master the following frontend technologies: