Hacker News new | ask | show | jobs
by adambard 4421 days ago
This solves one of the problems that '!' does, but not the other. If this file is concatenated with one that looks like it would accept a function call, it will be an error, because javascript. e.g.

    (function(){/* stuff */}())
    (function(){/* other stuff */}())
Is interpreted as:

    (function(){/* stuff */)())(function(){/* other stuff */}())
To correct this, you also need a semicolon.

    ;(function() {
        //code here
    })();
Alternatively, if you can stomach it (I can't), you can use the !.