run function in js code example
Example 1: javascript run function
var Object = {
Name:"John",
LastName: "Doe",
CallName: function() {
return this.Name + " " + this.LastName;
}
}
Object.CallName(); // Will return "John Doe"
Example 2: running a function in a function javascript
function runFunction() {
myFunction();
}
function myFunction() {
alert("runFunction made me run");
}
runFunction();
Example 3: javascript function call with variable
function abc() {
alert('test');
}
var funcName = 'abc';
window[funcName]();