I thought I understood how to use the ternary operator but now I’m unsure as I encounter an error with the following code:
const plantNeedsWater = function(day) {
day === 'Wednesday' ? return true : return false;
};
console.log(plantNeedsWater('Wednesday'));
I did figure out a way to make the following code work but I don’t know why it works:
const plantNeedsWater = function(day) {
return day === 'Wednesday' ? true : false;
};
console.log(plantNeedsWater('Wednesday'));