You can "cast" a JavaScript number to int:
nr = nr | 0
Then use the cents instead of decimal dollars.But it might be a good idea to use a bigint lib. And remember different countries might have different rounding rules.