Basic JavaScript - Multiple Identical Options in Switch Statements

The Terminal / console will not accept this.
I have tested it in VS Code and it works fine in that environment.

function sequentialSizes(val) {
  let answer = "";
  // Only change code below this line
switch (val) {
    case 1:
    case 2:
    case 3:
        answer = "Low";
    case 4:
    case 5:
    case 6:
        answer = "Med";
    case 7:
    case 8:
    case 9:
        answer = "High";
        break;
    case 10:
        answer = "Very High";
        break;
}


  // Only change code above this line
  return answer;
}

sequentialSizes(1);'

**Chrome**

User Agent is: <code>Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36</code>

**Challenge:** Basic JavaScript - Multiple Identical Options in Switch Statements

**Link to the challenge:**
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements

First, the instructions only asked you to handle numbers 1-9, so get rid of the one for 10.

Second, it is not working fine. Try adding the following before the return statement:

console.log(val, answer);

Then run the tests and look in the console pane. What is every number being tagged as?

From the instructions:

“If the break statement is omitted from a switch statement’s case, the following case statement(s) are executed until a break is encountered.”

Knowing this, what do you think you need to do in order to set answer to the correct string?

Thank you, Mr. Smooth!

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