Introduction to JavaScript Data Types
Primitive types
JavaScript provide six different data types that we call primitive
because they are immutable in nature. These types are always passed by
value, which means that we cannot modify them in-place. Additionally a
null primitive is provided that represents the absence of an object
value.
The primitive types are:
- undefined: A variable that has yet to be assigned a value.
- null: A variable that has yet to be assigned a value.
- Boolean: Logical entity that can be either
trueorfalse. - Number: Represents double-precision 64-bit floating-point numbers.
- String: Textual data.
- BigInt: Large integers exceeding the safe limit of Numbers.
- Symbol: Unique atom values.
Notice here that unlike many other programming lanuages, strings are immutable in JavaScript. We cannot modify them in-place, but rather have to create new strings when manipulating them.