Use the Conditional (Ternary) Operator (It should be working...)

Tell us what’s happening:

I don’t see why this code isn’t working. It is even identical to the answer given. Can anyone help me?
Thanks!
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 (Macintosh; Intel Mac OS X 10.11; rv:61.0) Gecko/20100101 Firefox/61.0.

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

Remember the difference between the equality operators and the assignment opertator.

3 Likes

Wow, thanks. Can’t believe I didn’t think of that…