Resurreccion ff9ee6814b corrected conditionals (#29295)
previous version passed the tests, but were only relevant to the numbers  tested, not what the question was asking for.
2019-01-15 16:51:07 -06:00

683 B
Raw Blame History

Use Multiple Conditional (Ternary) Operators

We need to use multiple conditional operators in the checkSign function to check if a number is positive, negative or zero.

Heres a solution:

In the function body we need to add multiple conditional operators - as in our lesson:

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

In this way, function can check if a number is positive, negative or zero.

Heres a full solution:

function checkSign(num) {
  return (num > 0) ? "positive" : (num < -12) ? "negative" : "zero";
}
checkSign(10);