Use the Conditional (Ternary) Operator why it is wrong

Tell us what’s happening:

I didnt find why its wrong. I can´t resolve for False statement

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_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36.

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

You need to use a comparison operator ===. What you are doing there is setting a equal to b

Take a look at a = b.

= assigns a value
== or === compare values

Thanks for your answer. I achived pass the test. I read again my notes.

1 Like