Having a problem with the Chaining If Else Statements in JS

Having a problem with the Chaining If Else Statements in JS
0

#1

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);

#2

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


#3

@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!!!


#4

Ah we were typing at the same time!


#5

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