1// variable:
2var num1;
3var num2;
4// function:
5function newFunction(num1, num2){
6 return num1 * num2;
7}
1// Create a function (you decide the name) that logs out the number 42
2// to the console
3
4// Call/invoke the function
5
6 function number(){
7 console.log(42)
8 }
9
10 number()
11//result = 42
1function runFunction() {
2 myFunction();
3}
4
5function myFunction() {
6 alert("runFunction made me run");
7}
8
9runFunction();
1function myFunc(p1, p2, pN)
2{
3 // here "this" equals "myThis"
4}
5let myThis = {};
6
7// call myFunc using myThis as context.
8// pass params to function arguments.
9myFunc.call(myThis, "param1", "param2", "paramN");
1function abc() {
2 alert('test');
3}
4
5var funcName = 'abc';
6
7window[funcName]();