In PHP, there's this handy construct where you can use the value of a variable as the name of a function, so when you call $foo() you would call the real function bar() or baz(), depending on the value of $foo in the current scope.

Is there an equivalent in JavaScript, and if so, what is it? I am looking at taking the return of an Ajax callback and using it to decide whether to add or remove a classname from an element.

Thanks in advance,


You received this message because you are subscribed to the Google Groups "Prototype 
&" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to