IIFEs (Immediate-Invoked Function Expressions) can be used to create and immediately call a function in order to establish explicit scope boundaries, as shown below. An additional advantage of this is that certain arguments within the function can be defined at the end of the call and applied using generic variables (such as 'n' below) within the IIFE.
Closure involves creating a reference to a variable value that can then be pulled out of the originating scope. In the example below, an instance of staticValue is set when getClosure() is called, and this instance is accessible by the function that is returned. The value is remembered and manipulated by future calls of the returned function, even when used outside of the scope of the function that generated it. This is useful in that it allows the creation of semi-global variables that can be accessed within a large instantiated scope (such as in a single-page app) without relying on the global scope. There are a variety of other event-driven advantages to being able to package functions and references in this way.