Function doesn't work or misspelled sth

Tell us what’s happening: The function isn’t working. I check it from many sides and still doesn’t run the test correctly.

Your code so far

// Setup
function testEqual(val) {
if (val == 12); { // Change this line
  return "Equal";
return "Not Equal";

console.log (testEqual(10));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36.

Challenge: Comparison with the Equality Operator

Link to the challenge:

in the line you changed there is an extra character

I think you should be getting a syntax error indicating the issue

look carefully

1 Like

it didn’t tell me syntax error but yes, it was the “;”. Thanks for the help. :slight_smile:

It would not be a syntax error. The semi-colon just makes the if statement code block like it is an unrelated next statement. It is no longer part of the if condition code block. That is why the function would always just execute return true.

1 Like