Why do I need to do declare a variable?

Hey everyone,

I guess this just flew over my head - but I’m a little confused over the solution suggested by Codecademy:

const plantNeedsWater = 
      function(day, plantNeedsWater){
         if(day === 'Wednesday'){
           return true;
         }
         else {
           return false;
         }
       };
  1. Why would I have to make it a variable? I tried just making it a function and it seems to work fine.

  2. Why is plantNeedsWater a parameter in the solution above? ‘day’ changes and is affected in the if and else statements. Why is plantNeedsWater listed as a parameter above? I don’t quite get it.

The const and parameter just seems like code I don’t necessarily need, or am I missing something?

The code below (works):

function plantNeedsWater(day){
        if(day === 'Wednesday'){
          return true;
        }
        else {
          return false;
        }
      };

Thanks,
Malte

The code works, yes, but the exercise deals with function expressions, not function declarations. If an expression is expected, your code will not and should not be accepted.