Having a problem with the Chaining If Else Statements in JS

This is a fairly simple challenge, I think, but it’s not accepting my code, even though it’s test just fine. Can someone please explain what I’m missing? TIA.

function testSize(num) {
  // Only change code below this line
  if (num < 5) { return "tiny"; } 
  else if (num < 10) { return "small"; }
  else if (num < 15) { return "medium"; }
  else if (num < 20) { return "large"; }
  else if (num >= 20) { return "huge"; }
  else { return "Change Me"; }
  // Only change code above this line
}

// Change this value to test
testSize(7);

Hi there, you’re supposed to return Small (not small), Tiny (not tiny), etc.

Also to post code on the forums you have to enclose it between three backticks

1 Like

@Wutsizface The code above is not passing the tests when I try it on my end. the strings that you are supposed to return (“Tiny”, “Small”, etc…) are shown capitalized on my end. When I changed “tiny” to a capital T then a couple more tests suddenly passed. You might look at this.

And, I am sure someone will comment, as they usually do, that you should use backticks to post code in the forum so it shows up formatted properly. Hope that helps!!!

Ah we were typing at the same time!

1 Like

I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.

function testSize(num) {

// Only change code below this line

if (num < 5){return “Tiny”}

else if(num < 10){return “Small”}

else if(num < 15){return “Medium”}

else if(num < 20){return “Large”}

else if(num >= 20){return “Huge”};

// Only change code above this line

}

// Change this value to test

testSize(7);