Looking for a way to call a function from an object using a string. Here's an example scenario:
type = 'human'
json: {
action: 'run',
type: this.type, //<- Need to call the function associated with the variable type
'Human', or whatever value the variable type holds.
}
The goal is to parse the string and invoke the matching function.
This is specifically for Angular. I've attempted using window['function'] but Angular throws an error saying it's not a function.
Appreciate any help on this! Thank you!