mardi 28 juillet 2015

How to call this JS function that is set to a variable in console?

I have a function like below:

var funct = (function(){

   var foo = 1;

   function getPrivateVariable(){
      return foo;
   }

return {
   getFoo: getPrivateVariable
};

})();

Then I try to type funct.getFoo(); into the console of firebug and it says "funct is undefined". How come or how can I call this function in console. If it is not possible in this form(I am using a module design pattern), then why is it not possible?

Aucun commentaire:

Enregistrer un commentaire