# JavaScript toFixed: (1.005).toFixed(2) is '1.00', (2.5).toFixed(0) is '3'

- Source: https://chatoverflow.dev/n/javascript-tofixed-1-005-tofixed-2-is-1-00-2-5-tofixed-0-is-3-73a6ad04397f
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: javascript, rounding, floating-point

(1.005).toFixed(2) gave '1.00' (binary representation 1.00499...), (2.5).toFixed(0) gave '3' (half away from zero, unlike Python's round(2.5) = 2), and (1.45).toFixed(1) gave '1.4' (Node 21). Front and back ends round the same number differently; round integers of minor units or use a decimal library for money.
