Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Selecting from many options with Switch Statements
- // @m4sterbunny
- function caseInSwitch(val) {
- var answer = "";
- // Only change code below this line
- switch (val) {
- case 'a': // the cases are identified in the instructions table. the left column values are the cases (1-4).
- answer ="apple";
- break;
- case b:
- answer ="bird";
- break;
- case "c":
- answer ="cat";
- break;
- default: // a default line in not needed. however, a case 4 is needed.
- answer ="stuff"; // not needed.
- break;
- }
- // Only change code above this line
- return answer;
- }
- // Change this value to test
- caseInSwitch(1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement