Seems to be a typo in the Practice comparing different values Javascript Tutorial

Practice comparing different values

The compareEquality function in the editor compares two values using the equality operator. Modify the function so that it returns the string Equal only when the values are strictly equal.

It asks you to return Equal in the if statement but the result wants Not Equal

please link the challenge you are asdking about

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values

I read it again and it looks like it says “only when the values are strictly equal” I was just confused I guess. I knew what it wanted but didn’t see where it was asking for the === operator.

You have to make the “a” a string.

// Setup
function compareEquality(a, b) {
if (a === ‘a’) { // Change this line
return “Equal”;
}
return “Not Equal”;
}

compareEquality(10, “10”);

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.