Use Multiple Conditional Operators

Tell us what’s happening:
It says to Use multiple conditional operators in the checkSign function to check if a number is positive, negative or zero. I’ve been stuck on this for nearly an hour trying stuff so I’d appreciate some help.

Your code so far

function checkSign(num) {
 return (num>=0?(num>0 ? "positive":"zero"):"negative"); 


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36.

Link to the challenge:


the problem is your syntax. I don’t think it can work the way you wrote it. Check the example in the challenge:

return (a === b) ? "a and b are equal" : (a > b) ? "a is greater" : "b is greater";

You could try this:

return (num > 0) ? "positive" : (num < 0) ? "negative" : "zero";

Hi Kyu,

But it’s working for all the test cases.So, I don’t think syntax should be the issue.

I believe FCC’s validation is interpreting your solution as a single conditional because you have the “second” conditional inside the “if” clause of the ternary. And it is expecting it to be in the “else” clause.

Just rework your logic a little bit and I bet it will let you pass. Sometimes the lessons are a little finicky.

Thanks Chad.It worked :slight_smile: