in javascript the IIFE and Closure principles
var f = (function() {
var localFunc = function(){};
var localVar1 = 3;
var localVar2 = 4;
// publish
return {
localFunc: localFunc,
localVar: localVar1
}
})();
f.localFunc(); // ok
f.localVar2; // nok
I don’t known if i answered the question
solved Retrieving variables from functions