Tell us what’s happening:
i tried displaying the result on console its not working whats wrong with my code
Your code so far
function sequentialSizes(val) {
let answer = "";
// Only change code below this line
switch (val) {
case 1:
case 2:
case 3:
return "Low";
break;
case 4:
case 5:
case 6:
return "Mid";
break;
case 7:
case 8:
case 9:
return "High";
break;
}
// Only change code above this line
return answer;
}
sequentialSizes(2);
console.log(val)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0
Challenge: Basic JavaScript - Multiple Identical Options in Switch Statements
If you look in the console, you should see an error message that says ‘Val is not defined’
You are getting that error messsage because you placed the console.log outside of the function and val is a function parameter and not defined outside of that function.
If you move the console.log statement in the beginning of your function then you will see the console output you are looking for.
Also as a sidenote, you don’t need to use break statements when a return is present.
Remember that the return keyword will exit the function so the break statement will not be reached.