Am i thinking about this wrong?

I’m on step 71 of fcc learn-recursion-by-building-a-decimal-to-binary-converter

It doesn’t accept this:
return input === 0 ? “0” : “”;

But it accepts this:
if(input === 0) {return “0”};
return “”;

  1. shouldn’t they be the same?
  2. Do I even need “input === 0”, shouldn’t, i be able to use “!input”, since 0 is falsy?

Like this:
return input ? “” : “0”;

Hello there!

Kindly include a link to this project.

They have already started you off by offering the if statement. Your task was only to return a string, which is why it accepted the if statement answer but not the ternary operator.

The second choice would be considered if they had not started you off using an if statement.

1 Like

oww, sorry, i didn’t look at the code outside of the whiter area. My bad!