ParseFloat function in JavaScript

前端 未结 5 744
暖寄归人
暖寄归人 2021-02-14 04:09

When I am adding two textbox values that are 1.001 and 0.001 and then I do a parseFloat I get 1.0019999999. I wan

5条回答
  •  日久生厌
    2021-02-14 05:04

    If you want to a quick fix you can round to the nearest thousandth

    Math.round((1.001+0.001)*1000)/1000

提交回复
热议问题