Is there a way to push a list of functions into an associative array? Here's what I'm trying to do:
var inits = {
"first" : fn1(),
"second" : fn2(),
"third" : fn3(),
"fourth" : fn4()
};
var functions = ['first','fourth'];
for(var index in functions ) {
inits[functions[index]];
}
The important part here is to be able to name each function and have it called based on a given array of function names. I can do this in PHP but can't figure it out how to do it in javascript.