JavaScript Bug Hunt Easy +10 XP
Const Reassignment
This code throws an error.
JavaScriptFind the bug
1
const count = 0;2
count = count + 1;3
console.log(count); The bug is on line 2
Select the correct fix
Show answer and explanation
Answer: Use let instead of const
const variables cannot be reassigned. Use let for variables that need to change.
Hint: const means the binding can't change.
What this challenge tests
Bug Hunt in JavaScript: const, let, variables.