I've been using if, else if, and else statements in my code but recently switched to switch statements which have made things much simpler. Now I'm wondering if it's possible to add multiple conditions inside a switch statement, similar to if statements.
For 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>
If I wanted to include a response based on whether the user types 'yes' or 'no' after being asked about eating another fruit, how could I add that condition inside the same case?
Is it possible to achieve something like that with switch statements? I hope my question makes sense.
Thank you for your assistance!