As I understand it, the IIFE pattern is a work around to the fact that ES5 and below do not have a way to create block scopes. By wrapping everything in a function and immediately invoking it, we can create a scope.
Now that let
and const
will gain support by more the browsers, does this reduce the need for something like the IIFE pattern?
let
to replace an IIFE, but what doesconst
have to do with any of that? The IIFE gives you privacy inside the scope and avoids namespace pollution.const
doesn't really help with namespace conflicts at all. It does provide write protection, but not read privacy. – Phobe