SpinTheMic
Pro

Interview practice question

Calculating money totals accurately

Frontend Engineering · JavaScript Core · Intermediate

Your checkout shows totals like 19.990000000000002. How do you handle money calculations correctly?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Floating point errors.
  • Store in minor units (cents) as integers.
  • Decimal libraries for complex math.
  • Round only at defined points.
  • Format with Intl.NumberFormat.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics