Please a hint on what i'm doing wrong :(


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

// Only change code above this line
}

testSize(7);

Hi! Would you mind posting a link to the challenge?


It looks like you’re trying to write a condition on the final else block.

sure

Challenge: Chaining If Else Statements

Link to the challenge:

Take a look again at the example syntax in the instructions:

if (condition1) {
  statement1
} else if (condition2) {
  statement2
} else if (condition3) {
  statement3
. . .
} else {
  statementN
}

Your else looks a little different.

1 Like

Hey, since you just asked for an hint I won’t say the solution. Try too look at your if else (condtion) statements.

if (num < 5){return "Tiny";}
//The first error lies in the if else statments, try too look it up how to write if else statements
if else (num < 10){return "Small";}
if else (num < 15){return "Medium";}
if else (num < 20){return "Large";}
else (num >= 20){return "Huge";}
// ^ There is also an error with the else statement

There is something wrong with that and also your else statment.

1 Like

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