[Javascript] 2 Decimal Places in Float

David Stoltz Dstoltz at SHH.ORG
Thu Apr 6 12:19:11 CDT 2006



Hi all,

If I have a statement like:

document.theTimer.cost.value = (parseFloat(myOperator) +
parseFloat(costToAdd));

And the resulting value is something like:

.02304040948378377

How can I "format" the resulting number to only show 2 decimal places,
like:

.02


???? Any help appreciated!
-Dave



More information about the Javascript mailing list