javascript function
// variable:
var num1;
var num2;
// function:
function newFunction(num1, num2){
return num1 * num2;
}
javascript function
// variable:
var num1;
var num2;
// function:
function newFunction(num1, num2){
return num1 * num2;
}
js create and call function
// Create a function (you decide the name) that logs out the number 42
// to the console
// Call/invoke the function
function number(){
console.log(42)
}
number()
//result = 42
running a function in a function javascript
function runFunction() {
myFunction();
}
function myFunction() {
alert("runFunction made me run");
}
runFunction();
javascript call
function myFunc(p1, p2, pN)
{
// here "this" equals "myThis"
}
let myThis = {};
// call myFunc using myThis as context.
// pass params to function arguments.
myFunc.call(myThis, "param1", "param2", "paramN");
javascript function call with variable
function abc() {
alert('test');
}
var funcName = 'abc';
window[funcName]();
how to call a function in JavaScript
// calling our function
displayGreeting();
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us