This content originally appeared on Bits and Pieces - Medium and was authored by Aman
There are 8 basic data types in JavaScript.
- Null
- Undefined
- Number
- Boolean
- BigInts
- Object
- String
- Symbol
How to remember them? Learn the mnemonic: NUNBBOSS.
Now that we know there are 8 data types, what exactly are these data types used for?
Of the 8 data types, 7 are primitive. And what exactly does “primitive” mean?
A primitive data type can contain only a single thing. All primitive types are immutable and we cannot set properties on them.
Objects are the only non-primitive type because they are used to store collections of data and more complex entities.
You might be thinking, “Hey but I heard that everything in JavaScript is an object! If a string is not an object, how come I can do the following:
The above logic makes the string “hi” look like an object because we are using a method on it. This is an illusion! JavaScript will create a temporary object when we want to use a method for a primitive type and then immediately discard it!
Build composable applications
Don’t build web monoliths. Use Bit to create and compose decoupled software components — in your favorite frameworks like React or Node. Build scalable and modular applications with a powerful and enjoyable dev experience.
Bring your team to Bit Cloud to host and collaborate on components together, and greatly speed up, scale, and standardize development as a team. Start with composable frontends like a Design System or Micro Frontends, or explore the composable backend. Give it a try →

Learn More
- How We Build Micro Frontends
- How we Build a Component Design System
- The Composable Enterprise: A Guide
- 7 Tools for Faster Frontend Development in 2022
JavaScript Interview Question: What are the 8 Data Types in JavaScript? was originally published in Bits and Pieces on Medium, where people are continuing the conversation by highlighting and responding to this story.
This content originally appeared on Bits and Pieces - Medium and was authored by Aman
Aman | Sciencx (2022-03-23T08:55:30+00:00) JavaScript Interview Question: What are the 8 Data Types in JavaScript?. Retrieved from https://www.scien.cx/2022/03/23/javascript-interview-question-what-are-the-8-data-types-in-javascript/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.