im a beginner at javascript and would appreciate some help
The question:
pete's pizza place is famous for great pizza at reasonable prices. Make a program that will help pete compute the price on the orders. make sure you add on 13% tax and that you display the answer to 2 decimal places. Pete's pricing is as follows:
- small: $5 for cheese + 0.75 per topping
- medium: $7 for cheese + 1.00 for each topping
- Large: $10 for cheese + 1.25 for each additional topping
Pete only has 10 available toppings, so if an employee types in more than 10, there must be some mistake. Assume they wanted 10.
Here is my code and the error:
let order, cost, small, medium, large, topping;
order = prompt("What size pizza?");
order = parseInt(prompt("How many additional toppings?"));
if (small==5.00){
cost = 5.00 * 1.13;
document.write ("$5.65");
}
else {
topping>=1==0.785+topping
}
document.write("Total $"+cost+topping.toFixed(2));
The last line (document.write("Total $...
) has this error:
Uncaught TypeError: Cannot read property 'toFixed' of undefined