Basic JavaScript - Chaining If Else Statements

Tell us what’s happening:
Why this code doesn’t pass?

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 (num >= 20) {
  return "Huge";
}
  // Only change code above this line
}

testSize(7);

Your browser information:

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

Challenge: Basic JavaScript - Chaining If Else Statements

Link to the challenge:

You have a small error in your code but your console should show you where this is and help you to spot what is wrong… Can you see an error message in the console?

1 Like

Thank you very much :heart_eyes: I missed the semi colon.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.