Advanced Scope: Execution Context and Why it Matters
Quick overview of execution contexts
An execution context is not a concrete thing, but ra...
It is common for programmers to approach learning scope by trial and error. Scope is a complex topic that can be very powerful when it is well understood, but it can also be a double-edged sword when used sloppily.
Advanced Functions: IIFEs, Closures, and the Module Pattern
In this tutorial, we are going to wrap up the topic of Scopes. We're pretty sure that you have a solid understanding of how lexical scopes work, and thus you are now prepared to tackle one of the most interesting and sometimes frustrating (not for you; you’ll see) topics: Closures. We could even say that this article has a closure over the first three articles (you’ll get this at the end)! Some developers struggle a lot to understand closures, but only because it’s necessary to master lexical scopes first. We have put a lot of time into mastering the execution context, so it’s very probable that this topic won’t be difficult for you. So, without further ado, let’s start!
IIFEs (Immediately Invoked Function Expressions)
We are going to start with IIFEs (Immediately Invoke...