Use the Conditional (Ternary) Operator kindly assist

Tell us what’s happening:
Kindy assist all is working but (1,1)

Your code so far


function checkEqual(a, b) {
 var a, b= "";
return a = b ?   true : false;
}

checkEqual(1, 2);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; 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

Always remember that = is the assignment operator. It does not check for equality.

2 Likes

I tried to change it but i still get the same error.

What is your current code? What does the failing test say?

Try deleting this line of code:

I get this once i do that

Ah, yes. You’re almost there. Now you just need to change a=b to be a===b :smile:

Thank you.Solved it.

Great! You can close this topic by marking as “answer” the suggestion that helped you solve it.