Function Expression vs Function Declaration vs Anonymous Function in JavaScript
//function declaration
function sum(a,b){
return a+b;
}
return a+b;
}
//function expression
// function expression first need to declare then only we can use
let sum = function (a,b){
return a+b;
}
//fat arrow function
const sum = (a,b) => {
return a+b;
}
// function expression first need to declare then only we can use
let sum = function (a,b){
return a+b;
}
const sum = (a,b) => {
return a+b;
}
Comments
Post a Comment