convert int to float in javascript 1

convert int to float in javascript

float_num.toFixed(2);

Here is what the above code is Doing:
1. We’re creating a variable called float_num and assigning it the value of 1.2345.
2. We’re creating a variable called rounded_float_num and assigning it the value of float_num rounded to 2 decimal places.
3. We’re creating a variable called fixed_float_num and assigning it the value of float_num rounded to 2 decimal places.

Similar Posts