Skip to interview prep
Apexed

3. Fix the invoice total

EasyDebugging & productionDebugging

invoiceTotal receives prices as strings in dollars, like "19.99", and must return the total formatted with exactly two decimals, like "20.00". Some totals come out wrong.

Example 1

Input: invoiceTotal(['0.10', '0.20'])
Output: "0.30"

Constraints

  • Fix the bug; keep the function signature

Tab indents · Ctrl/⌘ + Enter runs · Esc then Tab leaves the editor

Run checks these cases; the expected output comes from the reference solution. Submit judges all 4 hidden and sample tests.

Code runs only in your browser in an isolated sandbox. Progress and submissions are saved on this device.

Fix the invoice total — coding interview practice — Apexed