Concise Body?

const plantNeedsWater = (day) => {
  return day === 'Wednesday' ? true : false;
};

Why isn’t this working?

const plantNeedsWater = day => day === 'Wednesday' ? true : false;

Isn’t working, or isn’t passing?

In the shortest form possible, it would look like this…

const plantNeedsWater = day => day === 'Wednesday';
1 Like

It isn’t passing the exercise.

Just an FYI, your code doesn’t seem to pass either. I can’t figure it out and don’t like to hit the ‘solution’ button. Someone explain this, maybe I’m missing something?

Ok, I figured it out actually. Even though I had commented out the first function because I wanted to use it for reference, it will still seeing it and asking me if I removed the () around day, which I had. In my function, which was NOT commented out. Maybe a bug? Before this, I could comment out originals and keep them for reference when I was refactoring.

1 Like

There are various testing methods employed of which in some cases, the actual code pattern is part of the check in order to confirm use of keywords, etc. That may be the case here.

If the lesson also expects the ternary expression, then it follows my example will not pass (but works as expected).

1 Like

I’ve run into similar on the JS course. If you want to keep the previous code you’re refactoring, as well as commenting it out I’ve started adjusting the old function name by adding/removing a random character.

It doesn’t get picked up by the SCT then, so you can keep the old code you’re re-writing. :slight_smile:

3 Likes