🌍 Public
Viewing a saved revision (read-only)
86b7a05cb9284a1b89dc0c2669911f0e
Cars Report
This example demonstrates a loading state and a text report of cars under a price threshold, using JavaScript promises and array methods. It fetches car data from a hardcoded JSON string via the `getCars` function, which resolves after a 2-second delay. The `generateReport` function filters cars by price and formats each entry using the `formatCar` utility, displaying results in a `<pre>` element. The page initially shows "Loading..." then updates with the report, relying on native `Promise`, `setTimeout`, and DOM manipulation through `getElementById`.
AI-generated descriptionAn example tutorial