function world(params){
//Code to be executed when the function is called.
}
world()
//Explaination
//'world' in the function is the name of the function.
//There are brackets after function name. Those are use to push parameters
//The forth line Calls the function named 'world'
// NOTE : Function defined using (Function CONSTRUCTOR) does not
// inherits any scope other than the GLOBAL SCOPE
var x=7;
function A(){
var x=70;
function B(){
console.log(x); // 70
}
let C = function(){
console.log(x); // 70
}
let D = new Function('console.log(x)'); // user caps F
B(); // 70
C(); // 70
D();// 7 - Inherits always the GLOBAL scope
};
A();
var add = function(num1, num2) {
return num1 + num2
}
When a function is called with the new keyword, the function will be used as a constructor.