I have a number with decimal places and I am wondering if it's possible to round the decimal to the nearest whole using javascript?
My number is: 4.59
I need my number to round to: 4.60
Use Number.toFixed(number of decimal places):
var num = 4.59;
var rounded = num.toFixed(1);
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