Use the Conditional (Ternary) Operator1

Use the Conditional (Ternary) Operator1


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:


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


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


what @wawraf said is true.

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