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 strict";
// Strict code here
}());
My question is how to declare global variables in this case? Three alternatives that I know of today:
Alternative 1:
var GLOB = {};
(function(){
"use strict";
}());
Alternative 2:
(function(){
"use strict";
window.GLOB = {};
}());
Alternative 3:
(function(win){
"use strict";
win.GLOB = {};
}(window));
Any preferences and motivations? Other options?