QuestenaՎարժանք, որը ցույց է տալիս՝ ինչ կրկնել հաջորդիվ
Հարց 93

An outer block declares let level = 1. A nested block declares its own let level = 2. What does level mean inside the nested block?

  1. It refers to the inner binding whose value is 2Ճիշտ պատասխան
  2. It is permanently ambiguous between both bindings
  3. It refers to the outer binding because it was declared earlier
  4. Both declarations are duplicates in the same scope

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

The nested declaration shadows the outer binding, so references inside that nested scope resolve to the value 2. Shadowing does not overwrite or delete the outer level; after leaving the nested scope, the outer binding still has value 1.

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

Սկսել վարժանքը
Հարց 93: An outer block declares let level = 1. A nested block… · JavaScript Fundamentals · Questena