You can set this using IIFE:
var f = (function () { function f () { console.log(fa); } fa = 'Test'; return f; })(); f()
Note that you do not need to use f (or even a function declaration) to work correctly:
var f = (function () { var _f = function () { console.log(_f.a); }; _f.a = 'Test' return _f; }); f()
Some people like to use the same variable to emphasize that inner f will eventually become outer f , and some people prefer to distinguish between each area. In any case, this is normal.
snickle
source share