Data in JavaScript
In programming, a concept of data type is important to label and classify any digital information given. This is important because the program must know the characteristics of the information because a computer cannot understand the information given.
Therefore, different data in programming have data types.
The Data Types in JavaScript
There are two sub-groups of data types: primitive and non-primitive
Primitive: Primitive data types are the most basic data types in JavaScript. They are immutable, meaning their values cannot be changed once created. Each primitive type represents a single value.
Non-Primitive: Non-primitive data types, also known as reference types, are more complex. They can hold collections of values and more complex entities. Unlike primitive types, non-primitive types are mutable, meaning their values can be changed.
Immutability: Primitive types are immutable, while non-primitive types are mutable.
Storage: Primitive types store the actual value, whereas non-primitive types store references to the values.
Primitive Data Types
String: Represents textual data.
Number: Represents both integer and floating-point (approximation of real) numbers.
Boolean: Represents a logical entity and can have two values: true
or false
.
Undefined: A variable that has been declared but not assigned a value.
Null: Represents the intentional absence of any object value.
Symbol: A unique and immutable primitive value, often used as keys for object properties.
BigInt: Represents integers with arbitrary precision.
In this introductory programming course, we will not be learning non-primitive data types.
Recommended Readings
Data Types (Link)
Last updated