I am having a little trouble with this assignment for school. I am using JavaScript to make a menu and give the total price of that order. I am doing 4 menus: Breakfast, Lunch, Dinner, each with sides (Trying to get a little extra credit). I am supposed to use prompt() for this assignment. I was able to get the numbers in an array but I can't get them to equal out anything. I have posted the code I have, but if there is a simpler version I will gladly be doing that too.
I have the menu in HTML and the code itself for the javascript is in the <script>
tag.
const b1 = 4;
const b2 = 5;
const bs1 = 2;
const l1 = 10;
const l2 = 20;
const l3 = 5;
const d1 = 10;
const d2 = 20;
const s1 = 2;
const s2 = 3;
const s3 = 5
function orderHere() {
var i = 0;
var order;
sum = 0
for (i = 0; i < 2; i++) {
order = prompt("What would you like to eat today?", "Order Here" + (i + 1));
sum += order;
}
alert("Your price is $" + sum + ". Enjoy your meal!");
}
orderHere();