In regular browser js, we can do this:
window["fname"] = function(){ /* do something */ };
then we can call fname
where ever we want - it is now a global function. Is it possible to do a similar thing in node, where we add functions to a certain object and they can be called as is in the rest of the file:
root["fname"] = function(){ /* do something */ };
fname();
I'm not looking for a something that acts globally over all files, just something that would keep the "global namespace pollution" in this file that I can call all of these functions as is, without resorting to obj.fname
.