Code Room
Code reviewMedium
Question
Review this JavaScript cart total + tax routine.
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.
Learn the concepts
function total(items, taxRate) { let sum = 0; for (const it of items) { sum += it.price * it.qty; } const withTax = sum * (1 + taxRate); return Math.round(withTax * 100) / 100;}// total([{price: 0.1, qty: 3}], 0) -> ?Run or narrate your approach, then ask the coach.