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

A for loop declares let i in its initialization. Which scope owns that i binding?

  1. The whole program
  2. The nearest function regardless of nested blocks
  3. The surrounding block even after the loop finishes
  4. The for loop itselfՃիշտ պատասխան

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

A let binding introduced by the for initializer is scoped to that loop, including the loop body where appropriate. It does not become a binding of the surrounding block after the loop ends, and no closure-timing premise is needed here.

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

Սկսել վարժանքը
Հարց 96: A for loop declares let i in its initialization. Which… · JavaScript Fundamentals · Questena