(function() {
var theArg;
google = function(arg) {
theArg = arg;
alert(theArg);
}
yahoo = function() {
alert(theArg);
}
})();
google("hello");
I am not getting the alert in yahoo function. What i am missing here and what is going wrong.
Giving a quick example to the comments in the main question.
Script
HTML Page
In my experience if you call this without assigning to window it will not alert anything as the function will be undefined. As mentioned in comments, this is a scope issue.