One involves encapsulating a complex calculation in the global scope to keep it separate from inline code. This involves writing a function as an expression and without a name, and then burying it in parentheses (other syntaxes are possible) to establish the new scope. The encapsulated function may take parameters supplied to the function in their own parenthesized list, and has to return a result, perform an action, or leave some other side-effect in a global variable. The nice part is that within this temporary and protected scope you can declare “local” variables without having to worry about collisions with named variables in other scopes (mostly the global scope).
The other way involves encapsulating the code in an entire file within parentheses, which puts all its code and variable names in a separate scope and namespace. A lot of frameworks are apparently distributed in this form and the contents are accessed by declaring a local (global) variable and setting it to the contents of the external file, so everything in it can be addressed as
This can be done just as easily with a traditional function, at least for inline code at the global level.