Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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 !.


Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: