javascript call function based on variable code example
Example 1: js call function by string name
function test() {
console.log('Executed function "test".');
}
window['test']();
Example 2: javascript function call with variable
function abc() {
alert('test');
}
var funcName = 'abc';
window[funcName]();