I recently started with Modular javascript files. But I am facing an issue when trying to call internal functions. My script is like this
var myTeamMaster=(function(){
alert(function1());
var function1=function()
{
alert("function1");
}
var function2=function()
{
alert("function2");
};
return
{
function1:function1,
function2:function2
}
})();
As you can see Im just calling function1() from the alert. Its triggering object expected error. I didnt understand why?