JSFiddle - React, Tailwind, and code Playground
JavaScript
var Prices = [60, 50, 40, 30];
var Usersname = prompt("Please enter your name");
while(Usersname == null)
{
Usersname = prompt("Please enter your name");
}
console.info(Usersname);
function numSeats () {
var seats = prompt("Please enter the number of seats you want to buy");
parseInt(seats);
while((seats == null)||(seats > 6))
{
seats = prompt("Please enter a number between 1 and 6");
parseInt(seats);
}
return seats;
}
var seatswanted = numSeats ();
function seatingChoice () {
var choice = prompt("Please enter where you would like your seats to be located by indicating the correct number from the table");
parseInt(choice)
while((choice == null)||(choice > 4))
{
choice = prompt("Please enter a number between 1 and 4, corresponding to your section choice");
parseInt(choice);
}
return choice;
}
var seating = seatingChoice();
var dollaramt = (seatswanted * Prices[seating-1]);
console.log(Usersname + " ordered " + seatswanted + " tickets for a total of " + "$" + dollaramt + ".");