BeginnerCoder

Lesson 6 — Objects

Objects

An object groups related data as key: value pairs inside curly braces, and you read a value with a dot: user.name. It describes one thing with many properties.

Why it matters: objects model real-world items — a user, a product, settings — and are the shape of almost all web data (JSON).

Tip: you can also read a property with brackets, user["name"], handy when the key is in a variable. Assigning to a new key (user.age = 20) adds it.

Want it another way?
Task

Add age 20 to user and log the sentence: Alex is 20

Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.

← Back
Next →
Test your knowledge

A quick 3-question quiz on this lesson — instant feedback.

Enjoying this lesson? Share it.