I’m trying to execute a function based on the result of a prompt. I extract the name of the function as a string from an array of strings. To simplify my code:
// functions abc() and dfg() are defined previously let modList = [“abc”,”dfg”]; let modFunction = ModList; let output = modFunction(string);
Gives me an error
modFunction is not a function.
Looking through stack overflow, I see that there is a way to do this using a “window” context which I’m assuming doesn’t exist in Drafts, or through the
eval() function. The same code with
let output = eval(modFunction(string))
gives me the same error.
I’m probably doing something wrong but what?