Don't understand the firts solution

Hello , i don’t understand about the 1st solution with that :

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

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

// Change this value to test
caseInSwitch(1);

How   var answer = ""; can take val if it's note declare like : 
var answer = "val";  ????

Can you paste the link of the challenge here?

I found the link of the challenge.


The code tells us that val is the variable of the function caseInSwitch(), and inside this function there is another variable answer.
In this case, for example, if val equals 1, then answer equals "alpha"

1 Like

i understand now thanks a lot ! :smiley: