When I do this in my node.js module:
var abc = '123';
Where does it go? And by this I mean: in the browser it goes in window.abc (if not executed in a function or otherwise)
If I execute this:
abc = '123';
Then I can find it in global.abc, but that's not how I want it.
Unlike the browser, were variables are by default assigned to the global space (i.e. window) in Node variables are scoped to the module (the file) unless you explicitly assign them to module.exports.
In fact, when you run "node myfile.js" or "require('somefile.js')" the code in your file is wrapped as follow:
(function (exports, require, module, __filename, __dirname) {
// your code is here
});
Node has a module scope, so var abc = '123' in a module will create a variable which is scoped to (and therefore, reachable only for code in) that module.