Sikau

Project: A JavaScript app · Day 6 · about 55 min

Final: the ordering app

Everything together: async menu, live cart, quick orders and a retrying checkout.

Ship it

Put every piece together in one working app: load the menu from the kitchen, render it, keep a Cart in sync with the page, accept typed quick orders, and place the order with retries — showing friendly messages along the way.

Wiring the whole app

The final app is mostly wiring: every part already exists and has been tested on its own. An async start() function runs once when the page loads. It shows a loading message, awaits the menu, renders it, connects the event listeners, and shows the empty totals. Wrapping start-up in an async function lets it use await and catch a failed load in one place.

async function start() {
  status.textContent = "Loading menu…";
  try {
    const menu = await withRetry(fetchMenu);
    renderMenu(menu);
    showTotals();
    status.textContent = "";
  } catch {
    status.textContent = "The kitchen isn't answering. Please refresh in a moment.";
  }
}
start();

Each feature then hangs off an event: clicking Add uses the cart, submitting the quick-order box uses parseOrder from Day 3, and the checkout button uses withRetry(placeOrder). Because every piece was built small and tested, connecting them is calm work rather than a debugging marathon.

The rest of this lesson

  • Messages people understandexplain
  • Start-uporder
  • Which day's piece?match
  • Busy kitchenpredict
  • The café ordering appchallenge
  • Badge quizquiz
  • Project complete!recap

Continue this lesson free — run real code in your browser

Continue with Google

See all 6 lessons of Project: A JavaScript app