I am trying to create some functions based on variable names, something along the lines of:
var functionsToRegister = ["foo","bar"];
var index;
for (index = 0; index < functionsToRegister.length; ++index) {
var function_name = functionsToRegister[index];
PART_IM_MISSING = new Function('return alert("hello, world!");');
}
The client code calls specific methods so for example it will call foo()
Please note that I am not working on a website but on a native windows application (SoftOne) that allows some customization options through a javascript engine.
Also there is absolutely no way to change the client code calling the functions.
functions[function_name]foo()or would it need to be called as functions["foo"]? Only the former would work.functions.foo()