QuestenaPractice that shows what to review next
Question 88

A program executes let score = 1 and later score = 2 in the same valid scope. What is the result?

  1. score remains 1 because later assignment is ignored
  2. A SyntaxError occurs because let permits only initialization
  3. A new nested binding named score is created automatically
  4. The existing score binding is reassigned and its value becomes 2Correct answer

Explanation

A let binding permits assignment of a new value after its declaration, so score becomes 2. The belief that let makes a value immutable confuses block scoping with the separate reassignment restriction associated with const.

Continue with this test

Start practice
Question 88: A program executes let score = 1 and later score = 2 in the… · JavaScript Fundamentals · Questena