Multiple Identical Options in Switch Statements what's wrong?

I don’t know why this is not working when I run the test.
I rand the code in console and it works just fine. Am I missing something?

function sequentialSizes(val) {

  var answer = "";

  // Only change code below this line

  switch(val){

    case 1:

    case 2:

    case 3:

      answer = "low";

      break;

    case 4:

    case 5:

    case 6:

      answer = "mid";

      break;

    case 7:

    case 8:

    case 9:

      answer = "high" 

    }

 

  // Only change code above this line

  return answer;

}

sequentialSizes(1);

Hello and welcome to freecodecamp forum. When you post your questions please click the get help button in the challenges section and then create a post button then post it. That way we can understand which challenge it is from and give you a better answer. Also the post and code in it will be formatted better so it’s easier to identify the problem.

1 Like

Hi @HiMyNameIs !

Welcome to the forum!

I have edited your post to include the challenge link, so we know what you are working on.


I’ve edited your post 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 (’).

Reread the instructions again and make sure you are assigning the correct values to the answer variable.

Hint: capitalization matters.

Write a switch statement to set answer for the following ranges:
1-3 - Low
4-6 - Mid
7-9 - High

2 Likes

Thanks! how did I miss it… :sweat_smile:
:sweat_smile:

1 Like

It’s ok, it happens to all of us :grinning:

2 Likes

Yeah, we all make mistakes like that. And yeah, we all feel like idiots when you do it. As you get better, you’ll get better and spotting them, but the mistakes just get more subtle - they never go away completely. Coding is a humbling experience.

3 Likes

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