In JavaScript, we have three ways to write any functions: function declaration, function expression, and arrow functions.
But I focused on the function expression and function declaration concept in this article.
Before talking about the key differences between them let see how they look.
Function Declaration
function foo(){
alert('hello')
}
foo();
The way is to write a function declaration is shown above. What we see?
Function expression
let name = function foo(){
alert('hello')
};
foo();
#javascript #coding #javascript-tips