We will cover the 7 primitive data types in javascript. A primitive data type can be described as a fundamental type used in a programming language that cannot be broken down any further. For example, a number is a primitive data type, whereas a map is an object that holds key-value pairs and order of the keys.
What is a data type?
A data type is an attribute of data that simply defines how the data will be used. A data type constrains the information accepted in the specific data. For this article, we will explain the seven different primitive data types used in javascript.
The list of seven primitive data types in JavaScript
Number
The number primitive data type is used for decimals and integers. For a more robust definition, check the docs for number here.
String
The string primitive data type is used for text. For a more robust explanation, check the docs for string here.
Boolean
The boolean primitive data type is used for making decisions. You can find the docs definition here.
Undefined
The undefined primitive data type is the value taken by a variable that is not yet defined. Read more here.
Null
The null primitive data type represents the intentional absence of any object value. The docs explanation can be found here.
Symbol
The symbol primitive data type represents a value that is unique and cannot be changed. For a full explanation, reference the docs here.
BigInt
The bigint primitive data type is used to hold numbers that would otherwise be considered infinity. A better definition can be found in the docs.
Understanding Primitive Data Types in JavaScript is Beneficial
These 7 primitive data types are essential to developing in JavaScript. Learning the building blocks of a programming language will help you daily during your programming career.
Find more information on JavaScript by searching the JavaScript tag.
2 COMMENTS