The value of the currency is larger than what javascript's numbers can hold, thus all computations must be done for string.
All the code that I came across with uses parseFloat()
or parseInt()
in some way.
Eg. The following string:
22222222222222222222.222222 is to be formatted as
$22,222,222,222,222,222,222.22
EDIT: I cannot use third party libs. It is just for display at the moment, but a more generic approach to handling large numbers in js is appreciated :)