Code RoomInvoice total rounds incorrectly
MediumPrep Room Coding #1746

Invoice total rounds incorrectly

Code reviewCode quality & reviewMid–Senior~25 min

Review this JavaScript invoice line-item total.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 25 min
Mark a line and say what kind of problem it is.0 findings
1function lineTotal(unitPriceUsd, qty, taxRate) {
2 const subtotal = unitPriceUsd * qty;
3 const tax = subtotal * taxRate;
4 const total = subtotal + tax;
5 return Math.round(total * 100) / 100;
6}
7 
8// lineTotal(0.10, 3, 0.0); -> expected 0.30
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.