I've read that JavaScript does not really have "static" variables(when i say "static", I mean it in the procedural programming style, like in C, not C++)
I managed to get this code section from this link on stackoverflow : I've Heard Global Variables Are Bad, What Alternative Solution Should I Use?
var FOO = (function() {
var my_var = 10; //shared variable available only inside your module
function bar() { // this function not available outside your module
alert(my_var); // this function can access my_var
}
return {
a_func: function() {
alert(my_var); // this function can access my_var
},
b_func: function() {
alert(my_var); // this function can also access my_var
}
};
})();
How do I call the function "bar" indirectly, if at all it is possible ?