I\'ve got a currency input and need to return only significant digits. The input always has two decimal places, so:
4.00 -> 4 4.10 -> 4.1 4.01 ->
String(4) // "4" String(4.1) // "4.1" String(4.10) // "4.1" String(4.01) // "4.01"
parseFloat works, but you've got to cast it back to a string.