Comparison with the Less Than Or Equal To Operator

Tell us what’s happening:

Your code so far

function testLessOrEqual(val <= 12) {
  if (val) {  // 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);

It’s giving me an “unexpected token” error for the first <= sign. When I tried to check previous posts to see if this was a known system error, I got a message saying that page was private or didn’t exist. Anyone know what’s up? (or do I really have something wrong in my code?)

You can’t write val <= 12 in the function’s parameter list. Instead you should do the comparison in the first if-block’s condition.

Thanks, Kev. I finally realized that was the problem, felt so stupid! Sometimes it just takes another pair of eyes.