Use the Conditional (Ternary) Operator not returning false statement

Tell us what’s happening:
Im using the Conditional(Ternary) operator, and it won’t return the false statement, but it will return the true statement. I’ve checked the hint to see if I’m doing something wrong, but my code matched the hint code exactly. I’ve looked online to see if there are other formats that are used, but no matter what I do, the false statement never returns. I even copied and pasted the solution from the hint page to see what would happen, and the false statement didn’t return then either.

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/605.1.15 (KHTML, like Gecko) Version/12.0.3 Safari/605.1.15.

Link to the challenge:

It should be a === b. I guess there is a typo in the hint.

Also using ternary here is redundant.

That worked, thank you.
I just copied what was in the title of the lesson.

Yeah, I solved it with a==b ? a==b : a==b; :slight_smile: it couldn’t be any more redundant.

1 Like