Let vs Const Quiz
Question
What happens if you try to reassign a variable declared with `const`?
Hint
const means 'constant' — the value should not change.
Explanation
Reassigning a const variable throws a TypeError at runtime: 'Assignment to constant variable.' This is because const creates a read-only binding — the variable name cannot be made to point at a new value. If you need to reassign, use let instead.
Related Resources
Related Lessons
- JavaScript Variables
Learn about let, const, and var in JavaScript.
Related Cheatsheets
- JavaScript Cheatsheet
Quick reference for JavaScript variable keywords.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.