0 of 8 problems solved • 0%
Use in a course

Variables with const and let

8 exercisesEasy

Variables give meaningful names to the information a program needs. Use const when the binding should stay fixed and let when it must be assigned a new value.

const playerName = "Mira"; let score = 10; score = score + 5; console.log(`${playerName}: ${score}`); // Mira: 15

Declare values, update counters, copy values, and choose names that reveal what the code is doing. A useful default is to start with const and reach for let only when reassignment is part of the idea.