I keep getting this wrong (Comparison with the Less Than Or Equal To Operator)

Tell us what’s happening:

  **Your code so far**

function testLessOrEqual(val) {
if (val <= 12) {  // Change this line
  return "Smaller Than or Equal to 12";
}

if (val <= 24) {  // Change this line
  return "Smaller Than or Equal to 24";
}

return "25 or More";
}

// Change this value to test
testLessOrEqual(10);
  **Your browser information:**

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

Challenge: Comparison with the Less Than Or Equal To Operator

Link to the challenge:

You did it correct only thing is the last return should be “More than 24” not “25 or More”.
The freecodecamp test for these exercise is quite picky on the result so even if it doesn’t really matter that the string means the same thing it wants it to be as default (that’s why they say to only change the commented lines)

you should be returning the string 'More Than 24' not '25 or More'

Read what it says should be the return value. The failed test have the value they expect. Capitalization makes a difference

you should return More Than 24 not More than 24
the string needs to match exactly for the test to pass

I solved it. I over-thinked it.

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