w3schools javascript execute code example
Example 1: javascript function call with variable
function abc() {
alert('test');
}
var funcName = 'abc';
window[funcName]();
Example 2: call function javascript
// Define your function
function sayHello(msg){
console.log("Hello, " + msg);
}
// Call it
sayHello("Norris");
// outputs:
// Hello, Norris