Use the Conditional (Ternary) Operator1

Use the Conditional (Ternary) Operator1
0

#1

Tell us what’s happening:
what is wrong?

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; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36 Avast/69.0.792.82.

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


#2

Hint: Your function is not comparing values a and b.


#3

you mean that it should be a==b right?


#4

what @wawraf said is true.

you need to read more about “JavaScript Comparison and Logical Operators”