Chapter 5 — Functions

New concepts: function declaration, arrow functions, default params, closures

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

Exercises

  1. Write classifyOrder(total, status) → 'HIGH-VALUE','STANDARD','CANCELLED'
  2. Convert to an arrow function — test both give the same result
  3. Write formatReport(orders, {minTotal=0, status=null}) with defaults
  4. Write a makeCounter() factory function using closure