JSFiddle - React, Tailwind, and code Playground

by Alex Fogarty

JavaScript

var user = prompt("What do you want to do? Eat, drink, or be merry?").toLowerCase();
var cookieNum;

switch (user) {
    case 'eat':
        var foodChoice = prompt("What would you like to eat? Cookies or cake?").toLowerCase();
        if (foodChoice == 'cake') {
            alert("Cake it is!");
        } else if (foodChoice == 'cookies') {
            cookieNum = prompt("Cookies? Ok, how many?");
            alert("Ok, here are " + cookieNum + "cookies");
        }
        break;
    case 'drink':
        
        var drinkChoice = prompt("Would you coffee or tea ?").toLowerCase();
       var tempChoice = prompt("Would you like it hot or cold ?").toLowerCase();
        
        if (tempChoice === 'hot' || tempChoice === 'cold'){
        alert("Great we have lots to choose from!");
        } 
        
        if (tempChoice === 'cold' && drinkChoice === 'tea') {
            alert("Great,ill get you iced tea");}
        else if (tempChoice === 'cold' && drinkChoice === 'coffee') {
            alert("Great,ill get you iced coffee");}
        else if (tempChoice === 'hot' && drinkChoice === 'tea') {
            alert("Great,ill get you hot tea");}
        else if (tempChoice === 'hot' && drinkChoice === 'coffee') {
                alert("Great,ill get you hot coffee");
           
            } else {
                alert("I dont think we have what youre looking for!");
            }


            break;
            case 'be merry':
                var merryChoice = prompt("what would you like to do?");
                alert("Cool let's " + merryChoice + " like it's 1999");
        
                break;
            default:
                prompt("I dont know what you want to do !");

        }