JavaScript · Intermediate · Ticket 5Ticket #23 · from Priya Raman, Product Manager
  1. Example
  2. Warm-up 1
  3. Warm-up 2
  4. Ticket
Brief
NEW TICKET#23 · Clients

Merge duplicate clients by email

Priya Raman · Product Manager
Opened today

“After the spreadsheet import, a lot of accounts have the same client two or three times: once from the import, once typed in by hand as "Ana@Studio.com " with a capital and a stray space. We'll add a "Merge duplicates" button. Two clients are the same when their email addresses match once you ignore capital letters and spaces at either end. Keep the name from the first one in the list, add up their invoice counts, store the address in lower case without the spaces, and keep the clients in the order they first appear. Can you write mergeClients?”

YOUR PLAN
  1. 1Watch an example2 min
  2. 2Warm-up 11 min
  3. 3Warm-up 21 min
  4. 4Fix the ticket16 min
BY THE END YOU CAN
  • Use a Map to find what you've already seen
  • Tidy a key before you use it
  • Build new objects instead of changing the input
About 20 minutes
Four short steps. Nothing is timed, and you can leave any time.