freeCodeCamp: Selecting with Switch Statements missing code tags in tests

Challenge Selecting from many options with Switch Statements has an issue. User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36. Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:


function caseInSwitch(val) {
  var answer = " ";
  // Only change code below this line
   switch(answer) {

      case 1:
      console.log("alpha");
      break;

      case 2:
      console.log("beta");
      break;

      case 3:
      console.log("gamma");
      break;

      case 4:
      console.log("delta");
      break;

    default:
   } 

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

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


```What to value to assign to var answer=" ";


About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (6 by maintainers)

Commits related to this issue

Most upvoted comments

function caseInSwitch(val) { var answer = val; //here need set answer = val and your code work!) // Only change code below this line switch (answer) { case 1: answer = “alpha”; break; case 2: answer = “beta”; break; case 3: answer = “gamma”; break; case 4: answer = “delta”; break;

}

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

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

Gah! I’m stuck, and not too sure what I’m missing on this… Any pointers, would be much appreciated…

`function caseInSwitch(val) { var answer = “”; // Only change code below this line

switch (val){ case “1”: answer = (“alpha”); break; case “2”: answer = “beta”; break; case “3”: answer = “gamma”; break; case “4”: answer = “delta”; break; }

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

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

@erictleung you rock. Just when we needed more first timers issues! ✨