Concise Body Arrow Functions JavaScript


#1

How can I assign Plant need water to an arrow syntax? And how can I include if statement after that?

https://www.codecademy.com/courses/introduction-to-javascript/lessons/functions/exercises/arrow-functions?action=resume_content_item


#2

We know how to write a function expression, which gets us half the way there…

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

#3

Thank you! But I wrote an arrow syntax based on that and it is not correct.

here is what I wrote:
const plantNeedsWater = (day) => {
return day === ‘Wednesday’ ? true : false;
};


#4

Do the instructions ask for a ternary? You know that `a === ‘b’ is a boolean, already, right?

return day === 'Wednesday';

is all we really need to return. It will be either true or false.