1const plantNeedsWater = function(day){
2 if (day === 'Wednesday'){
3 return true;
4 } else{
5 return false;
6 }
7}
8
9console.log(plantNeedsWater('Tuesday'))
1const getRectArea = function(width, height) {
2 return width * height;
3};
4
5console.log(getRectArea(3, 4));
6// expected output: 12
7
1const mul = function(x, y){
2 return x * y;
3}; //semicolon needs to be there as it is expression
4
5console.log(mul(10, 20));
1// Function Declaration
2function add(a, b) {
3 return a + b;
4}
5console.log(add(1,2)); //3
6
7// Function Expression
8const add = function (a, b) {
9 return a + b;
10};
11
12console.log(add(1,2)); //3