I don't get this lesson

Concise Body Arrow Functions

I don’t get this lesson

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

this gives the following message

“Did you refactor plantNeedsWater() to be a concise body?”

this is the hint

"const greaterThanFive = num => num > 5 ? true : false;"

What am I doing wrong here ??
Thanks in advance for the help.

Should the comparison be identity (===) as opposed to inequality (>)?

1 Like

Thank you for making me feel stupid now that I look at it.

It working now

1 Like

I am fighting with it… and I don’t understand either…
my answer of:

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

keeps coming back as wrong…

What I am forgetting about?


So after losing a hour on this, for the first time here on CA I was forced to look at the answer, JUST to find out that it was my answer… so was that a software bug? I did reset the exercise and it looks all good… unfortunately it kept returning an error!

I reset the exercise, and place the answer as it should be, as I came with and confirmed to be correct, and the error persisted… so it is definitely a BUG IMO.

HERE is the error note description:
const plantNeedsWater = day => day === ‘Wednesday’ ? true : false;
SyntaxError: Identifier ‘plantNeedsWater’ has already been declared
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)

So its not very clear but the error is the clue and commenting out the original const declaration wont help you… you have to delete it.

They do not make it clear that your refactored code will only be accepted if the original code is fully erased.

“SyntaxError: Identifier ‘plantNeedsWater’ has already been declared”