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

  1. Use filter() to get only Delivered orders from the sales array
  2. Use map() to add a vatAmount field (total * 0.20) to each order
  3. Use reduce() to compute total revenue from all Delivered orders
  4. Sort orders by total descending using sort() with a comparator