Practice: typed kiosk

Typed sales total.

Sum typed sales. Log units and the busiest city.

Goal

Log 25 units and Nairobi.

interface Sale {
  city: string;
  units: number;
  shillings: number;
}
const rows: Sale[] = [
  { city: "Nairobi", units: 12, shillings: 480 },
  { city: "Mombasa", units: 8, shillings: 320 },
  { city: "Kisumu", units: 5, shillings: 200 },
];
const units = rows.reduce((a, r) => a + r.units, 0);
const busiest = rows.reduce((a, b) => (a.units >= b.units ? a : b));
console.log("units", units);
console.log("busiest", busiest.city);