Chaining If Else Statements - cannot identify mistake

Tell us what’s happening:

can someone identify my mistake?

Your code so far


function testSize(num) {
  // Only change code below this line
  if (num < 5){
    return "Tiny";
  } else if (num >= 5 && num < 10){
    return "Small";
  } else if (num >= 10 && num < 15){
    return "Medium";
  } else if (num >= 15 && num < 20){
    return "Large";
  } else {
    return "Huge";
  } 
  
  
  
  // Only change code above this line


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

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements

It looks like you’re missing a closing brace }.

1 Like

You don’t need two conditions in the if statements

If a number isn’t less than five than it will pass num >= 5 by default, you don’t need that condition

1 Like

Thanks lionet-rowe. It worked.

No problem! @ilenia also raised a good point — you have some redundant logic.