I have an object:
let commands = {
help: () => consoleDialog('defaultMessage'),
ls: () => consoleDialog('defaultMessage2')
};
How can I use an argument as a key identifier to invoke the function held in value:
function changeText(currentValue) {
commands.currentValue()
}
In the example above, if currentValue is equal to help, then commands.help() should be executed.