JS - Data Types
Posted

JavaScript has 8 built-in data types (with the latest ECMAScript standard):
We have the Primitives ones:
- Null
- Boolean
- Undefined
- Number
- BigInt
- String
- Symbol
and the Objects.
And you can check the type of each data type with the typeof operator:
let helloMessage = "Hello World";
typeof(helloMessage); //Output: "string"
let myAge = 32;
typeof(myAge); //Output: "number"
const myPerson = {
name: 'Yves',
age: 32,
}
typeof(myPerson); //Output: "object"
We have also have undefined and undeclared which is basically when you define a variable without a value (the default value is undefined). And undeclared is just that the value hasn’t been never declared.
Useful Resources: