I am trying to create an object like below
var x = function x() {};
Does this create an object at window level/global level.Is it good way of using it ?
If this was written in the global name space.. meaning in a loaded script directly or in a script tag this will be global.
But if this was made inside, for example, a dom ready event or an onlad event handlers this wont be global.
Using window.variable makes it global even if you're inside any block.
window.x = function() {}then it will be global.