Viewing a saved revision (read-only)
4402f98a44a64bd9ba20808d859724a6
Cars Report
This example demonstrates a text-based report of cars filtered by price, displaying each vehicle's year, make, model, and cost as a formatted string list. It uses asynchronous JavaScript with a Promise-based `getCars` function that simulates a two-second network delay before returning a hardcoded JSON array. The `generateReport` module filters cars below a maximum price and applies the `formatCar` template literal for output. The page’s `<pre>` element initially shows "Loading..." and updates when the promise resolves. The code relies on ES modules, `JSON.parse`, and standard DOM methods like `textContent`.
AI-generated descriptionAn example tutorial of how to use JavaScript objects, arrays, and modules.