I used if, else if, and else statements before and today I've decided to use switch statements which really simplified my code. My question is, just like if statements, is there a way I can add multiple conditions inside a switch statement?
Here's an example:
<script>
var textInput = input.value;
switch (textInput) {
case "orange":
text = "You decided to eat an orange. Do you want to eat another fruit?";
}
document.getElementById("message").innerHTML = text;
</script>
But say I wanted to add a response to the question I added about if you wanted to eat another fruit. How would I add another condition inside that case to where I could get a response back if someone types in yes or no to the question?
Is something like that possible? I hope my question is easy to understand.
Thanks for your help!