Skip to content

Tag: closures

How are IIFEs useful post ES6?

I’m learning JavaScript and I understand the general function types, closures, etc. But with IIFEs my initial reaction was “if its immediately invoked, why not just inline it”. So I went and read this article that describes “4 Practical Use Cases” for IIFEs. However, two of which…

Javascript closures on heap or stack?

Where does JavaScript (according to the standard) store closures: heap or stack? Is there a third explicit place for closures? Answer In the end it is an implementation detail of the runtime. See Phoenix link As to implementations, for storing local variables after the context is destroyed, the stack-based im…