Immediately Invoked Function Expressions
In this lesson, we'll cover a concept commonly asked about in JavaScript interviews. We'll see how immediately invoked function expressions allow us to overcome the problems of scope pollution and unwanted variable behavior.
We'll cover the following
Introduction
One of the goals of functional programming is to reign in the scope of variables. We want variables to only be accessible in their small, local scope, and only where they’re needed. This reduces the chance of bugs, since we can quickly find all pieces of code that a variable is connected to.
This lesson discusses one way to implement this idea. We’re learning a tool to reign in variable scope and keep variables as localized as possible.
Get hands-on with 1400+ tech skills courses.