I want to convert the integer to floating number with precision 2. ie. -
11 => 11.00
45 => 45.00
Please help me.
Thank you.
The representation of floating points in JavaScript follows the IEEE-754 format. It is a double precision format where 64 bits are allocated for every floating point.
By using parseFloat() Method.
Use .toFixed
:
var num = 45;
num.toFixed(2); //"45.00"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With