JavaScript encompasses eight data types:
The object data type can encompass:
1. An object
2. An array
3. A date
// Numbers: let length = 16; let weight = 7.5; // Strings: let color = “Yellow”; let lastName = “Johnson”; // Booleans let x = true; let y = false; // Object: const person = {firstName:“John”, lastName:“Doe”}; // Array object: const cars = [“Saab”, “Volvo”, “BMW”]; // Date object: const date = new Date(“2022-03-25”); |
Note: A JavaScript variable has the capability to store data of any type. |