February 2018
Intermediate to advanced
298 pages
8h 22m
English
Congratulations on making it to here! Let's face it, JavaScript has got some weird (and some bad) sides. Closures are on the weird side of JavaScript. Let's see what the term closure actually means.
When you declare a local variable, that variable has a restricted scope, that is, it cannot be used outside that particular scope within which it is declared (depends on var and let). As discussed earlier, local variables are not available outside the block (as in the case of let) or function scope (as in the case of var or let).
Let's take a look at the following example to understand what the preceding paragraph states:
function() { var a = 1; console.log(a); // 1} console.log(a); // Error
When a function is fully executed, ...
Read now
Unlock full access