If I define a function, let's say
function help() {
console.log('Help');
}
for some reasons, I cannot get the function object directly, all I got is the function name,
in browser, it would not bother at all, I can get function Help by window['help']
BUT in NodeJS module, as I know, all objects are defined in the anomynous namespace,
except for those objects which defined in global/exports/module.exports.
So how could I get the function Help under the circumstance(without changing function Help definition to global/exports/module.exports)?
@naomik
Actually the function Help is just a private function, I don't want to expose it...
now, I construct an object helpFuncs to hold function Help.
var funcName = 'Help';
var helpFuncs = {
Help: function() {}
};
So I can get the function object by helpFuncs[funcName].
btw, OMG, the format sucks, and github flavored markdown is really much easier to use.