Viewing a saved revision (read-only)
bac1febe62b748ac89dd582ac2b0a2a1
Cars Report
This example demonstrates a data-reporting workflow for a small dataset of five used cars, showing how structured data can be transformed into a readable text summary. It begins by displaying a “Loading...” message while using a promise-based `getCars()` function to simulate an asynchronous fetch with a two-second delay. Once resolved, the `generateReport()` function filters vehicles by price and applies the `formatCar` module to convert each car object into a formatted string like “2000 Honda Accord: $2800”. The final report is rendered inside an HTML `<pre>` element, with JavaScript modules and object destructuring driving the entire process.
AI-generated descriptionAn example tutorial of how to use JavaScript objects, arrays, and modules.