← JavaScript learning path
JavaScript · Module 6 of 10

Objects

Group related data and behaviour in objects with properties and methods.

📖 Key ideas

  1. An object holds key-value pairs: const user = { name: "Asha", age: 20 }.
  2. Read with dot or brackets: user.name, user["age"].
  3. Methods are functions inside objects.
  4. Destructuring: const { name } = user.
  5. Spread copies: const copy = { ...user, age: 21 }.
💡 Real-life example: An object is an ID card: name, photo, age and address together in one place.
PropertyA key-value pair in an object
MethodA function stored on an object
DestructuringPulling values out into variables
Spread ...Copies items or properties