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'
}
else{
}
return "Change Me";
// Only change code above this line
}
console.log(testSize(4));
Hello and welcome to the community !
In the future to post your code as well as a link to the step use the âhelpâ button which appears next to the âresetâ button after unsuccessfully submitting your code a few times:
Your code is in fact correct. The issue is a syntax error:(This doesnât allow the code to be tested even if some conditions are met. Always check the console for errors when your code canât run.)
As you can see your quotation marks are curly instead of straight as they should be:
you can use either single or double marks but they have to be straight:
"hello" or 'hello'
Btw your text âtinyâ should be with an uppercase âTâ.
Edit: I think your brackets are ok in the actual step but look different in the post. It might just be your lowercase âtâ which is causing the error.
All the return strings should have the proper case.
testSize(0) should return the string
Tiny
@anon86258595 Just a heads up, the forum will do that to code when it isnât formatted properly. So if you see code like that it will often have the wrong type of quotes.
But people do sometimes write their code in some Wordpad app or on a phone where it can happen.
Iâve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the âpreformatted textâ tool in the editor (</>
) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.