← JavaScript learning pathJavaScript · Module 6 of 10
Objects
Group related data and behaviour in objects with properties and methods.
📖 Key ideas
- An object holds key-value pairs: const user = { name: "Asha", age: 20 }.
- Read with dot or brackets: user.name, user["age"].
- Methods are functions inside objects.
- Destructuring: const { name } = user.
- 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