I\'ve read all over the place that global variables are bad and alternatives should be used. In Javascript specifically, what solution should I choose.
I\'m thinking
You really don't want to do this.
As to why, see e.g. the top post here: What is the most EVIL code you have ever seen in a production enterprise environment?
As a side note, one can always execute "global" code without littering the place with globals:
(function () {
var notaglobal = 1;
alert(notaglobal);
})();
//notaglobal is not defined in this scope