Objects in javascript

Objects are key-value maps and the core data structure in JavaScript. Keys are strings or symbols, and values can be any type. Use dot or bracket notation to read/write properties. Helpers like Object.keys, Object.values, and Object.entries make it easy to iterate.

Example

const user = {
  name: "Punam",
  age: 25,
  skills: ["JavaScript", "React"],
};

user.location = "India";
const skillCount = user.skills.length;

const keys = Object.keys(user);      // ["name","age","skills","location"]
const values = Object.values(user);  // ["Punam",25,[...],"India"]
const entries = Object.entries(user); // [["name","Punam"], ...]

Objects let you group related data and behavior behind named properties; Object.keys/values/entries help you loop over that data.