Objects store keys & values. This dynamic nature became the absolute reference format for internet communication: JSON (JavaScript Object Notation).
Literal Declaration
Written with curly braces {}.
main.js
const user = { name: "Raffi", age: 20, hobbies: ["Coding", "Gaming"]};// Accessing key (Dot Notation)console.log(user.name); // "Raffi"Destructuring (ES6)
A quantum leap in JS syntax style that "explodes" or extracts property contents esthetically.
main.js
const car = { brand: "Toyota", color: "Black", year: 2024 };// We explode the properties into instant variablesconst { brand, year } = car;console.log(brand); // "Toyota"console.log(year); // 2024