I have a variable
var fval = 4;
now I want out put as 4.00
JavaScript only has a Number type that stores floating point values.
There is no int.
Edit:
If you want to format the number as a string with two digits after the decimal point use:
(4).toFixed(2)
2.1m questions
2.1m answers
60 comments
56.9k users