This question already has an answer here:
- How to execute a JavaScript function when I have its name as a string 32 answers
Consider I have a name of a function which does not require any argument in a var -
var fn = "foo";
Can I execute it in some or similar like this -
eval(fn);
It does not work. Please suggest.
My definition of function will look like this -
function foo() {
....do something....
}