Tell us what’s happening:
I can solve the problem when I eliminate the “(num == 0) ?” part of the final condition statement , but why does the code not work the way it is now? For what I have here now, why is the last condition statement not treated essentially as another “else if” statement? Just wondering for future use.
This is more if/else situation where both true and false expressions are required rather than else if. In challenge second condition is just nested. Currently the lack of false expression for the last condition results in syntax error.
The reason is essentially the same as why the operators are called Ternary Operators.
The phrase is a set of three. This: (num == 0) ? "zero" is not a set of three. Once you put the ? operator, the compiler expects there to be an option if true and an option if false. That is why you could replace the above statement with this:
(num === 0) && "zero"
This will give you the result you want.
Granted, you can have a ternary operator phrase look like this: