Hacker News new | ask | show | jobs
by Stoo 4014 days ago
That's it. This is often called the module pattern. It's often used to avoid polluting the global scope with variables, e.g.

(function() { var x = 1; console.log(x); })();

console.log(x);

Would output:

1

undefined