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.

تابع هذا الاختبار

بدء التدريب