JavaScript writes a number with 2 decimal place and it will show 0 in decimal?
I have no worry about round off the number because I am accepting only 2 decimal place number
let num = 2.60
console.log(num) // result 2.6
It will return 2.6
but I want 2.60
. I can use to.Fixed(2)
but it will return in string format.
let num = 1.23
console.log(num) // result 1.23
I know to.Fixed()
but it returns string. I want number format and it show 1.00
and 1.60
in number format not in the string format. I have used parseFloat(num.toFixed(2))
but it does not show last 0
value in decimal.