2 ms·
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.l
by Stoo 11y 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