Chaining If Else Statements error

Chaining If Else Statements error
0

Tell us what’s happening:
Hi guys

I am trying to figure out the solution for the chain of “if” “else if”

The problem is not the solution but that sometimes different solution which give same results may work or not

It seems like there is an error in the system and that if you do not put the number that it wonts wont work

even if your solution is correct
]
does anyone else have the same issue ??

Your code so far


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 "
  }
  return;
  // Only change code above this line
}

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36.

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

Some of your returned values have no spaces, some have a space at the beginning, some have a space at the end. I suspect that at least two of your returned values are incorrect.

2 Likes