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

Exercise prompt

Avoid Shadowing a Score

Shadowing happens when an inner declaration uses the same name as an outer variable. Updating the inner value does not update the outer one.

Example

let count = 1; if (true) { let count = 2; console.log(count); // 2 } console.log(count); // 1

Your task

The inner let score creates a separate variable, leaving the scoreboard at 5. Change only the inner update so the existing outer score becomes 8. Do not declare another variable.

Hint

Is the inner line updating a value or introducing a new one?