Javascript problem

Tell us what’s happening:

what’s the problem with the code?

Your code so far

function caseInSwitch(val) {
  var answer = "";
  // Only change code below this line
  switch (val) {
    case val === 1:
    return "alpha";
    case val === 2:
    return "beta";

    case val === 3:
    return "gamma";
    case val === 4:
    return "delta";

  // Only change code above this line  

// Change this value to test

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:

You don’t need to explicitly type val === 1, by typing case it’s already doing the val ===; all you need is to put the value. ex:

case 1:

1 Like

In addition to what @zapcannon99 mentioned, you have not followed the instructions of the challenge. The instructions say:

Write a switch statement which tests val and sets answer for the following conditions:
1 - “alpha”
2 - “beta”
3 - “gamma”
4 - “delta”

Where are you setting the value of answer variable and why did you delete the return statement below the line shown below:

  // Only change code above this line  

You must pay attention to all the details given in the instructions and code comments supplied by the challenge.