Functions Declaration : In Javascript Function Declaration means that we write function with specific name.
We can call this function before writing this. its work fine.
Function Expression : In Javascript Function Expression means that we did not give a name to the function, we create function and store this in a variable.
We can call this function after writing, we can not call before this.
// Function Declaration
function calcAge1(birthYear) {
return 2021 - birthYear;
}
const age1 = calcAge1(1990);
console.log(age1);
// function Expression...
const calcAge2 = function (birthYear) {
return 2021 - birthYear;
}
const age2 = calcAge2(1980);
console.log(age2);
0 comments
Post a Comment