Slide 2
Slide 2 text
@asoluka_tee
3. The joe function is invoked, placed in the call stack (notice that by this time, sally is no longer in the call stack
because it has finished executing so its environment has been cleared up).
4. During the execution of the joe function, joe makes reference to variable age but then which variable age? Ah yes!
the one stored in the closure (notice that the closure created at step 2 lives in joe’s execution environment hence
we have access to it).
Tip: Closure is created when a child function makes use of (or references) a variable within its parent/lexical scope.