Lesson 2 — let and const
let and const
Both create variables. Use let when the value will change later, and const when it should stay fixed. Prefer const by default — it prevents accidental changes.
Why it matters: choosing const makes your intent clear and catches bugs where a value changes by mistake.
Watch out: a const cannot be reassigned, so use let for counters and running totals.
Create a const city and log: I live in <city>
A quick 3-question quiz on this lesson — instant feedback.
Ready for more? These paid resources pick up where this lesson leaves off.
Project-based JavaScript Foundations video courses — the perfect paid next step after these free lessons.
Browse on Udemy →Hand-picked JavaScript Foundations books to master the fundamentals offline.
See on Amazon →Some links on this page are affiliate links: we may earn a commission at no extra cost to you. We only recommend tools we believe are genuinely useful.