function statements vs code example
Example 1: function expression vs function declaration
const functionExpression = function(width, height) {
return width * height;
};
console.log(functionExpression(3, 4));
// Result = 12
function functionDeclaration(width,height){
return width * height;
};
console.log(functionDeclaration(3,4));
//Result = 12
Example 2: javascript function expression
const mul = function(x, y){
return x * y;
}; //semicolon needs to be there as it is expression
console.log(mul(10, 20));