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

A let binding named secret exists only inside an if block. No outer secret binding exists. What happens when code reads secret after leaving that block?

  1. The last value assigned inside the block
  2. The value undefined without an error
  3. A ReferenceErrorՃիշտ պատասխան
  4. A TypeError

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

The block-scoped binding is no longer accessible after control leaves its lexical block, and no outer binding can satisfy the lookup. Reading the name therefore throws a ReferenceError rather than yielding the old value or undefined.

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

Սկսել վարժանքը
Հարց 115: A let binding named secret exists only inside an if block.… · JavaScript Fundamentals · Questena