Use Multiple Conditional (Ternary) Operators help

Tell us what’s happening:

checkSign should use multiple conditional operators
how to explan it?
I’m just use if /else if, why can’t work?

Your code so far


function checkSign(num) {
  if(num > 0) {
      return "positive";
  } else if(num < 0) {
      return "negative";
  } else if(num === 0) {
      return "zero";
  }
}

checkSign(10);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators

The tests are checking if you are using ternary operators, which is different than if/else chain

Thank you give hint let me know how to write, but why if and else if and else can’t work, still confused.:face_with_raised_eyebrow:

Because the challenge wants you to use the ternary operator - it is required from the challenge that you don’t use if/else, so you can’t pass the challenge with it