Use Multiple Conditional (Ternary) Operators

Continuing the discussion from freeCodeCamp Challenge Guide: Use Multiple Conditional (Ternary) Operators:

function checkSign(num) {

return (num < 0) ? “negative”

: (num > 0) ? “positive”

:(num === 0) ? “zero”

: “”

}

checkSign(10);

Hello there.

Do you have a question?

If so, please edit your post to include it.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more information you give us, the more likely we are to be able to help.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.