javascript what is a funtion expression code example
Example 1: function expression javascript
const getRectArea = function(width, height) {
return width * height;
};
console.log(getRectArea(3, 4));
// expected output: 12
Example 2: js function expression
const plantNeedsWater = function(day){
if (day === 'Wednesday'){
return true;
} else{
return false;
}
}
console.log(plantNeedsWater('Tuesday'))