Selecting with Switch Statements missing code tags in tests
See original GitHub issueChallenge 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=" ";
Issue Analytics
- State:
- Created 7 years ago
- Comments:17 (6 by maintainers)
Top Results From Across the Web
Selecting from Many Options with Switch Statements can't ...
Your code so far function caseInSwitch(val) { var answer = "" ... Selecting from Many Options with Switch Statements can't pass the test....
Read more >Switch Statement in C/C++ - GeeksforGeeks
The switch statement is a multiway branch statement. It provides an easy way to dispatch execution to different parts of code based on...
Read more >Test for multiple cases in a switch, like an OR (||)
When the switch executes, it finds the first matching case statement and then executes each line of code after the switch until it...
Read more >The "switch" statement - The Modern JavaScript Tutorial
A switch statement can replace multiple if checks. It gives a more descriptive way to compare a value with multiple variants.
Read more >switch - JavaScript - MDN Web Docs - Mozilla
If no matching case clause is found, the program looks for the optional default clause, and if found, transfers control to that clause, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub 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);`