Use Multiple Conditional Operators 2018.08.1

Use Multiple Conditional Operators 2018.08.1
0

#1

Why my code wrong???

Your code so far


function checkSign(num) {
    return (num > 0) ? “positive” : (num < 0) ? “negative” : “zero”;
}

checkSign(10);

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0.

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


#2

When using " instead of ,
it works.


#3

Did you copy/paste the solution from somewhere else on the forum? The curly quotes are a typical result of doing that.


#4

Strings in JavaScript are defined using " or '. The “ is not a valid character for doing that so the code results in an error.