1
If I want to call a static function by name as string, how do I?
I did what is below, suppose the function name is "move".
class Transformation {
static operate(object, function_name) {
eval(function_name)(object);
}
static move(object) {... some code...}
}
But it didn’t work.
NOTE: I am calling this function from another file in the same directory.
I translated the question into Portuguese. But the warning: usually the questions that are posted in English on this site are quickly closed.
– Victor Stafusa