January 2017
Beginner to intermediate
550 pages
10h 6m
English
As ES5 did not provide block scope, a popular pattern to achieve block scope was to use immediately invoked function expressions (IIFE), for example:
(function () {
var block_scoped=0;
}());
console.log(block_scoped); //reference error
With ES6's support for block scopes, you can simply use a let or const declaration.
Read now
Unlock full access