Bug in #94? Never set value to a variable that was required

I wasn’t paying attention to the requirements and just started typing. My code produced the correct results but skipped setting a value to the variable “answer”. Is this normal since the return value was correct or is it a bug in the problem.

Your code so far

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

// Change this value to test

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36.

Link to the challenge:

No bug. When you use the return statement like below:

  return "alpha"

the function returns the value “alpha” to the calling function and does not execute any further code inside the caseInSwitch function, so the last line of:

  return answer;

never gets executed, so it does not matter you did not change answer’s original value of “” (a blank string). Your function returns the correct value for each test case.