In the last few lectures, we discuss Values & Variables and Convention and Rules for naming Variables. Values can have different types in every programming language, depending on the kind of data we want them to hold. And we already saw
Primitive value. We will learn all about Objects later but for now, let's focus on Primitive data types.
Primitive Data Types
There are seven primitive data types,
BigInt. So let's look at them one by one.
The numbers are always so-called floating-point numbers, which means that they always have decimals, even if we don't see them or don't define them.
My convention was to use a single quote, but you can also prefer double-quotes.
The boolean data type is essentially a logical type that can only take one of the logical values
false. In other words, a boolean is either true or false. We use boolean values to take decisions with code, as we will see later.
These three data types, number, string, and boolean are the most frequently used and essential data types.
Undefined is the value taken by the variable that is not yet defined. A variable that's not yet determined is simply a variable that we declared without assigning a value.
So, we can say that
Undefined means an empty value to an existing variable.
Null is also pretty similar to Undefined because it also means empty value, but it is used in different circumstances. For now, don't worry about the details, I just want you to know that
null also exists.
Symbols were introduced in ES2015(ES6), and this data type was not valuable for us; it is used to define a unique value that cannot be changed. And we will talk about this briefly by the end of this course.
Starting with ES2020, there is also
BigInt for integers that are too large to be represented by the number type. So, basically, it is another type of
number , and we will talk about this one in another section.