.call in js code example
Example 1: javascript function call with variable
function abc() {
alert('test');
}
var funcName = 'abc';
window[funcName]();
Example 2: javscript call
myFunc.call(thisArg, ...args)
Example 3: call function javascript
// Define your function
function sayHello(msg){
console.log("Hello, " + msg);
}
// Call it
sayHello("Norris");
// outputs:
// Hello, Norris
Example 4: how do i call a js method?
<button onclick="sayHello()">say hello</button> <script> 'use strict'; </script>