JavaScript Variables Practice
JavaScript variables are easier when you practice the difference between names, values, and reassignment. These questions focus on let, const, and simple expressions.
JavaScript variable practice teaches the difference between a name, a value, and a binding. That difference matters when choosing let, const, and reassignment.
Track the value after every statement. If const feels confusing, separate reassignment of the binding from mutation of an object or array stored in that binding.
- let, const, and block scope
- Reassignment and updated values
- Primitive values compared with arrays
Example practice questions
Try these samples, then continue into the JavaScript Practice Labfor guided browser-based practice.
Which keyword declares a variable that can be reassigned?
Answer: let
Which keyword declares a value you do not plan to reassign?
Answer: const
After let count = 2; count += 3; what is count?
Answer: 5
What type of value is stored by const name = 'Mia'?
Answer: A string
Can a const array have items pushed into it?
Answer: Yes, the array can mutate even though the binding cannot be reassigned.
What is the value of total after let total = 1; total = 4?
Answer: 4
Which keyword creates a block-scoped variable?
Answer: let or const