Cars Report
✓ Published0🌍 Public
This example demonstrates a text-based report of cars priced under £25,000, generated asynchronously from a hard-coded JSON array. It shows how JavaScript modules, promises, and array methods like `filter` and `map` can transform raw data into formatted output. The code uses `getCars()` with a simulated 2-second delay to mimic an API call, then `generateReport` combines `formatCar` to display each vehicle’s make, model, sale price, and retail price. The result populates the page’s `<pre>` element, replacing a "Loading..." placeholder.
AI-generated descriptionI've been learning how to use JavaScript objects, arrays, and modules to formulate a report on car prices that are less than £25,000.
MIT Licensed