Capstone: A Sales Summary

Combine filter, map, reduce, and object shorthand to turn a raw array of orders into a clean summary — exactly the data-shaping a real dashboard does.

Step 1 of 3

The brief

You're handed a raw array of orders — the kind of data an API returns. Your job is to boil it down into a small summary object a dashboard could display. You'll use the whole modern toolkit at once:

  1. filter the orders down to the ones that are "paid".
  2. reduce those paid orders into a total revenue.
  3. map them to a list of customers.
  4. Assemble a summary object using property shorthand.

This "raw data in, clean summary out" transformation is what a React component does before it renders. Same data work, whether it ends in console.log or in JSX.

Tip

Build it one variable at a time and log as you go. Get paidOrders right first, then compute revenue and customers from it, then bundle them into summary.