Chapter 4 — Array Methods
New concepts: map, filter, reduce, sort, find, some, every
Open the browser Console (F12 → Console) to see output from console.log().
Exercises
- Use filter() to get only Delivered orders from the sales array
- Use map() to add a vatAmount field (total * 0.20) to each order
- Use reduce() to compute total revenue from all Delivered orders
- Sort orders by total descending using sort() with a comparator