Use the Conditional (Ternary) Operator...I don't find any wrong in return statement but it shows wrong

Tell us what’s happening:

Your code so far


function checkEqual(a, b) {
 
return a==b ? "true" : "false";
}
checkEqual(1, 2);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

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

You should be returning the boolean values true or false, not the strings "true" or "false".

Edit: Note that in production code, you shouldn’t be using the ternary operator at all for this type of thing; if you need to return a boolean based on a condition, you should simply write return <condition> (for example: return a === b). This won’t pass the tests, because it doesn’t use the conditional operator, but it is functionally equivalent.

1 Like

thank you,it’s running successfully.