I have following javascript to make function $E
On window.onload
it throws error that $E
is not defined.
So my question is how do I make $E
visible in the global scope so I can access it outside the (function(){})();
function
window.onload = function() {
$E("bhavik").warn();
}
(function() {
function $E(s) {
return new ge(s)
}
function ge(sel) {
this.arg = sel;
return this;
}
ge.proto = ge.prototype = {warn: function() {
alert(this.arg)
}};
ge.proto.hi=function(){alert("hi "+this.arg)}
$E("bhavik").hi();
})(window);