What are Objects?
Objects are containers that group related data together. Instead of having separate variables, you can organize them into a single object.
Think of objects like:
- A backpack that holds related items
- A profile card with your information
- A recipe with ingredients and instructions
Basic Syntax
⚡ javascript
1
2
3
4
5
6
7
8
9
// Creating an object
const person = {
name: 'Alex',
age: 12,
grade: '7th'
}
// Each line is a property
// Format: propertyName: value