It\'s considered good practice to use a self-invoking function to wrap strict mode compliant code, often called the strict mode pragma:
(function(){ \"use stri
IMO alternative 3 is best. But it assumes that window represents the global scope - which is true for the browser but not for other JS environments (command line, Node.js, etc.).
window
The following will work across the board:
(function(globals){ "use strict"; globals.GLOB = {}; }(this));