Duncan Leung · May 5, 2020
JavaScript Closures: Lexical Scope and the Environment That Survives Function Return
0Sign in to vote or save
This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.
A closure is a function bundled with the lexical environment it was created in. That environment survives because the closure holds a reference to it - which is why each call to a function factory returns an independent counter.
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.