JavaScript · Intermediate · Ticket 3Ticket #21 · from Tomás Reyes, Support Lead
  1. Example
  2. Warm-up 1
  3. Warm-up 2
  4. Ticket
Brief
NEW TICKET#21 · Invoice list

Sort invoices with a tie-breaker, then page them

Tomás Reyes · Support Lead
Opened today

“Two complaints about the invoice list, and I think they're one bug. First, page 1 starts with what should be on page 2: the earliest invoices are missing. Second, a studio that sends 30 invoices on the 1st of every month sees the same invoice on two pages and never sees others. Invoices are listed by due date, earliest first; when two are due the same day, the lower invoice number should come first, every time. Pages start at 1. Can you fix invoicePage?”

YOUR PLAN
  1. 1Watch an example2 min
  2. 2Warm-up 11 min
  3. 3Warm-up 21 min
  4. 4Fix the ticket11 min
BY THE END YOU CAN
  • Write a comparator with a tie-breaker using ||
  • Work out where a page starts
  • Sort a copy, not the list you were given
About 15 minutes
Four short steps. Nothing is timed, and you can leave any time.