Basic JavaScript - Multiple Identical Options in Switch Statements

Tell us what’s happening:
I’m pretty sure I’ve got this right, when I test at the bottom it says ‘undefined’ but looking at the ‘let answer = “”;’ and then the switch statement, does this not ‘define’ the input? Any help appreciated.

function sequentialSizes(val) {
  let 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
}
console.log(sequentialSizes(6));


```javascript
function sequentialSizes(val) {
  let 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
}
console.log(sequentialSizes(6));


Your browser information:

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

Challenge: Basic JavaScript - Multiple Identical Options in Switch Statements

Link to the challenge:

You deleted the return statement - without that, nothing is returned from the function.

Can’t believe I did that, appreciated!

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