how to call different methods of any function in javascript code example
Example 1: javascript function call with variable
function abc() {
alert('test');
}
var funcName = 'abc';
window[funcName]();
Example 2: how do i call a js method?
<button onclick="sayHello()">say hello</button> <script> 'use strict'; //force the context to be undefined function sayHello() { console.log(this); console.log(arguments); console.log('hello'); } </script>