ENع
الدرس 13 · How JavaScript really works

Scope and closures

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

Scope decides where a name can be used: every function call gets its own box of variables, linked to the box outside it, and a lookup only ever walks outward. A function remembers the scope it was created in, so a variable can outlive the call that made it. Follow an eleven-line counter as makeCounter() builds a scope, hands back a closure, and that closure keeps count alive from one call to the next.

12 دقيقة10 خطوات5 أسئلةIntermediate
شكل 13 · تفاعلي
جارٍ تحميل الرسم…
أو ← →

اختبار يتاح بعد الخطوة الأخيرة.