In js can I call a function in an object from a string? Hm, I show you with an example:
var Object = {
callMe : function() { }
}
Object.callMe();
This I can do, but what if I want to do this:
var string = 'callMe';
Object.string();
Can I somehow do this? Maybe I’m just thinking wrong here
For this use bracket notation, like this:
You can test it out here.
In JavaScript
obj.thing(dot notation) is accessing the same thing asobj["thing"](bracket notation).