Skip to main content
100%

Cars Report

✓ Published0🌍 Public
GGaurav Prachchhak
Last edited Jan 22, 2020
Created on Jan 22, 2020
Forked from Cars Report

This example demonstrates how JavaScript modules, arrays, and asynchronous functions generate a text-based car report. It loads a hardcoded JSON array of five cars, filters for models under $2,000, and formats each result into a line. The code uses `getCars()` with a `Promise` and `setTimeout` to simulate a delay, `generateReport()` with `.filter()` and `.map()`, and `formatCar()` for string interpolation. The final report is displayed in an HTML `<pre>` element using `document.getElementById()` and `.textContent`.

AI-generated description

An example tutorial of how to use JavaScript objects, arrays, and modules.

MIT Licensed

Similar vizzes