Need help with Use the Conditional (Ternary) Operator

Tell us what’s happening:

I cant seem to pass this test, i checked the hint and have the correct answer but still wont pass. Thoughts?

Your code so far

return (a = b ? true : false );

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

checkEqual(1, 2);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36.

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

return (a = b ? true : false );

Is a = b assignment or comparison?

Here’s a hint: The hint solution is actually incorrect. Perhaps reread https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator and see if you can come up with the solution now :slight_smile: . Let me know if you need more help.

i got it :slight_smile: thank you! not assigning a to b. ‘’’ a == b ‘’’

1 Like

Glad I could help :slight_smile: . a === b (strict equality) would also work as well.