NEW TICKET#2 · Invoice page
Show cents as dollars
Kwame Mensah · Designer
Opened today
“The new invoice page prints amounts straight from the database, so a client sees “Total: 123456” instead of $1,234.56. Ledgerwick stores money as whole cents, so we need one function that turns cents into what people expect to read. Hannah already wrote addCommas for the thousands. Refunds are stored as negative amounts and should read like -$5.00. Can you finish formatMoney?”
YOUR PLAN
- 1Watch an example2 min
- 2Warm-up 11 min
- 3Warm-up 21 min
- 4Fix the ticket11 min
BY THE END YOU CAN
- Split a number with
Math.floorand% - Pad a number to two digits with
padStart - Build text from parts with
+