javascript - Why does underscore use immediately invoked function expression to wrap all of its code? -


<html>     <head>      </head>     <body>         <script src="underscore.js"></script>         <script src="app.js"></script>     </body> </html> 

i saw whenever html loaded, code in underscore.js (even code don't need) executed because of invoked function expression. flaw of underscore.js? why don't wrap code of underscore.js inside normal object instead of function object (the invoked function expression) ?

it common pattern can control export. .call(this) may put on window or node's global.

as "all code ... executed" - functions won't executed, parsed other scripts.


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -