JavaScript · Film for Functions and closures

Clarifying JavaScript Closures

A local variable should be gone when its function returns. In JavaScript, it can stay. That one rule explains counters, click handlers, and the loop that prints three, three, three.

0:00 / 4:18
Chapter 1 · What should happen to a local variable

Chapters

    Keyboard

    • Space Play or pause
    • ← → Back or ahead 5 seconds
    • [ ] Previous or next chapter
    • C Captions · M Mute · F Full screen

    Transcript

    Notes for class

    Take it with you