call a function in javascript code example
Example 1: running a function in a function javascript
function runFunction() {
myFunction();
}
function myFunction() {
alert("runFunction made me run");
}
runFunction();
Example 2: javascript call
function myFunc(p1, p2, pN)
{
}
let myThis = {};
myFunc.call(myThis, "param1", "param2", "paramN");
Example 3: how to call a function in JavaScript
displayGreeting();
Example 4: Functions call functions js
function sum (arr) {
let suma = 0;
for (let i = 0; i < arr.length; i++) {
let num= parseInt(arr[i]);
suma += num;
}
return suma;
}
function mean (arr) {
let average = sum(arr) /arr.length;
return average;
}
Example 5: call function javascript
function sayHello(msg){
console.log("Hello, " + msg);
}
sayHello("Norris");