QuestenaPractice that shows what to review next
Question 92

The same lexical scope contains let count = 1 followed by let count = 2. How is this program classified?

  1. Valid, with count equal to 2
  2. Valid, with two bindings selected by assignment order
  3. A TypeError during the second initialization
  4. A SyntaxError caused by the duplicate declarationCorrect answer

Explanation

Two lexical declarations of the same name in one scope are not permitted, so the duplicate let declarations cause a SyntaxError. Declaring the same spelling in a genuinely nested scope would instead be shadowing, not this duplicate-declaration case.

Continue with this test

Start practice
Question 92: The same lexical scope contains let count = 1 followed by… · JavaScript Fundamentals · Questena