With block statements + let/const, IIFEs are no longer needed to emulate
block-scoped variables. That got me thinking, are there other uses of
IIFEs, or are they no longer needed?

I’ve checked my code and found instances of this pattern:

var foo = (function () {
    var a, b, c; // helper variables
    // some computation
    return /* final value of foo */;
}());

Btw, there is a "do expression" proposal (stage 0) [1] for this type of
pattern.

Anything else?


[1]: https://github.com/tc39/ecma262/issues/132
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to