Currency operations with javaScript?

后端 未结 2 426
一个人的身影
一个人的身影 2020-12-19 08:47

I\'m creating a budget application with javascript. I have to let javascript do most of the operations. So I have some controls where the user changes the desired amount for

2条回答
  •  Happy的楠姐
    2020-12-19 09:15

    Always with currency keep track of it as integers internally. All operations should be done on integers. Only have the decimal for display.

    check out this fiddle if you are thinking about using decimal points to keep track of money.

提交回复
热议问题