This is preview!
No, it isn't. It is executed after the script is parsed, all variable and function declarations have been processed and any preceeding global code has been excuted.1. It's executed immediately.
Variables and functions declared inside a function can be accessed from outside that function (i.e. from some other scope) using a closure. This technique is used to emulate privileged functions (i.e. functions that can get and set "private" members).[...]
3. Anything declared with "var" inside the function is private to that function and cannot be accessed from outside it.
"Export" is not such a good term, what you are describing is making values accessible by assigning them to properties of global objects (or at least objects available from some other scope). Deliberately not declaring variables in order to make them global is a bad strategy, it should always be done explicitly, e.g.:You can "export" something from inside the private scope by either not declaring it var, in which it will default to being global, or by attaching it to the global window object or any other global object.