DrillsThe total says $011.504.002.99
The total says $011.504.002.99
What happened
Bolt connected QuickBite's checkout to the restaurant's menu API. With a Pad thai and Spring rolls in the cart, the total on the checkout screen is nonsense. It looked fine yesterday, when prices were typed into the code by hand.
A beta testerYour checkout wants $011.504.002.99 from me. I'm flattered, but no.
What you seeOn screen
Total: $011.504.002.99
The MagisterRun it first and read what comes back. Then change the code if you like: your edits go to the review too.
Run it to see what the customer sees.
// Menu prices now come from the restaurant's API.
const items = [
{ dish: "Pad thai", price: "11.50" },
{ dish: "Spring rolls", price: "4.00" },
];
const DELIVERY = 2.99;
function orderTotal(items) {
let total = 0;
for (const item of items) {
total += item.price;
}
return total + DELIVERY;
}
const total = orderTotal(items);
console.log(`Total: $${total}`);
The code runs in your browser against stand-in data. Nothing is sent anywhere.
Your answer
Reviewed by AI against what a good fix needs. About 10 seconds.Sign in to get your answer reviewed
It's free. Anything you've typed here stays in this browser and is waiting when you come back.
Sign in with email