Basic JavaScript - Chaining If Else Statements

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

function testSize(num) {
  // Only change code below this line

  return Tiny;
else if(num<10){
  return Small;
else if(num<15){
  return Medium;
else if(num<20){
  return Large;
  return Huge;
  // Only change code above this line


Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Basic JavaScript - Chaining If Else Statements

Link to the challenge:

Those are strings you are returning. They need to be wrapped in quotes.

so you need to wrap the return string in quotes solution :


when function testSize() is called this conditional statement is executed so we have a condition in the if and else if part of a statement and output as a return statement whenever the condition of any part of the statement is met the output code is executed and the use of return statements ensures that the function immediately exits after evaluating a condition and providing the relevant output, preventing it from proceeding to evaluate subsequent conditions. if none of the condition is met the code inside the else statement is executed giving an output

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

I will remember this next time. Thank you !!
How can I report if i see something like this.

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