Switch function

Tell us what’s happening:
Was i right in think that /&& would have worked?

  **Your code so far**

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


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

sequentialSizes(1);
  **Your browser information:**

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

Challenge: Multiple Identical Options in Switch Statements

Link to the challenge:

no, because a switch will check the value between the parenthesis with each case using strict equality, like val === (1 && 2 && 3)
and 1 && 2 && 3 evaluate to a single number, you can check which one if you do console.log(1 && 2 && 3)

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