Chapter 9 — Classes and Modules

New concepts: class, constructor, methods, inheritance, static

Open the browser Console (F12 → Console) to see output from console.log().

Exercises

  1. Create an Order class with properties and a formatTotal() method
  2. Add a static Order.fromCSVLine(line) factory method
  3. Create a SalesReport class that takes an array of Orders and computes KPIs
  4. Add a toString() method to Order that returns a formatted summary string