QuestenaՎարժանք, որը ցույց է տալիս՝ ինչ կրկնել հաջորդիվ
Հարց 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 declarationՃիշտ պատասխան

Բացատրություն

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.

Շարունակեք այս թեստով

Սկսել վարժանքը
Հարց 92: The same lexical scope contains let count = 1 followed by… · JavaScript Fundamentals · Questena