Tell us what’s happening:
Describe your issue in detail here.
**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 {
return " Huge";
}
}
console.log(testSize(0));
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36
Challenge: Chaining If Else Statements
Link to the challenge:
Why are some of your strings starting with a space and some not? Which do you think might be right?
The details trip up more of us…
I do not think that matters. Let me fix if it works
you are right sir, i got it
1 Like
The tests being run are very exact, and literal. Just Something to watch for.
You can also try Switch statement instead of using so many else if. Using a switch, in this case, is a more proffered way to complete the task.
Switch tests equality. How would you code this to test for less-than in a switch?
system
Closed
8
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.