Ternary solution not working out

Tell us what’s happening:
I have watched the video. Searched other places on the web. I still can’t pass the test on this. the answer is the exact first option given on the video.

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; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36.

Challenge: Use the Conditional (Ternary) Operator

Link to the challenge:

The instruction states

The function should return either "Equal" or "Not Equal".

Meaning that the function should return one of those two strings.
Yours, is returning a boolean (true/false)

Side note
this syntax is redundant:

return a===b ? true: false;

You can simply return the result of the evaluation if you want a boolean

return a === b // either true or false

Hope this helps :slight_smile:

Thank you so much! I get confused on some of the terminology. The video answer is wrong! What you show makes sense. The values for a and b would have to be set in order to use true or false. THank you so much!

Someone needs to check the video explanation.

I created an issue on the GitHub tracker to let the core team know the video needs to be updated.

1 Like