function declaration and expression code example
Example 1: js function expression
const plantNeedsWater = function(day){
if (day === 'Wednesday'){
return true;
} else{
return false;
}
}
console.log(plantNeedsWater('Tuesday'))
Example 2: function expression and function declaration
// Function Declaration
function add(a, b) {
return a + b;
}
console.log(add(1,2)); //3
// Function Expression
const add = function (a, b) {
return a + b;
};
console.log(add(1,2)); //3