Learn to Code
All tracks
Learn to Code

Free lessons from scratch to pro — every language, databases and DevOps.

AboutContactPrivacy PolicyTerms of Use

Your progress is saved in this browser. © 2026 Learn to Code

JS
JavaScript
0/12 completed
Beginner
What is JavaScript?Variables and data typesOperators and expressionsMaking decisions: if and switchLoops
Intermediate
FunctionsArrays and array methodsObjects
Advanced
Scope and closuresClasses and OOPPromises and async/await
Pro
The event loop
Tracks / JavaScript / Intermediate

Objects

An object groups related data under named keys. A user, a product and an API response are all naturally objects. Arrays answer "which position?"; objects answer "which name?".

Creating and reading objects

JavaScript · editable

Changing objects

JavaScript · editable

const stops you from reassigning the variable, but you can still change the object's contents.

Safe access with ?.

Real data often has missing pieces. Optional chaining (?.) stops and returns undefined instead of crashing.

JavaScript · editable

Methods and this

A function stored in an object is called a method. Inside it, this refers to the object.

JavaScript · editable

Looping over objects

JavaScript · editable

Destructuring and spread

JavaScript · editable

JSON: objects as text

JSON is the text format that APIs use to send data. Converting between objects and JSON is an everyday task.

JavaScript · editable

Practice: word counter

Count how many times each word appears in a sentence and print an object like { the: 2, cat: 1, ... }.

JavaScript · editable
✎ Check your understanding

1.How do you read a key whose name is stored in the variable k?

2.What does user?.profile?.photo return if profile is missing?

← Arrays and array methods