Is it possible to store the name of a function as string in JS, and invoke it from an object, pretty much like the PHP code below?
$this->$someFunc();
Is it possible to store the name of a function as string in JS, and invoke it from an object, pretty much like the PHP code below?
$this->$someFunc();
Sure thing. Try this:
var f = "foo";
var result = obj[f]();
where foo is a method on obj, or
this[f]();
where foo is a method on the current instance.