<!DOCTYPE html>
<head></head>
<body>
<script> // I am stuck so I am just guessing on how to select from many options using switch statements
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);
</script>
</body>
</html>
You either need to write:
answer = “alpha”;
or
answer = ‘alpha’;
You were mixing the double quote with the single quote. Either use both double quotes or both single quotes to surround a string.
Also, I edited your post for readability. When you enter a code block into the forum, remember to precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>
) will also add backticks around text.