+ 10
How to round off a no. to the nearest specified decimal value
4 Réponses
+ 16
Hey bro do this:-
Lets take a number 1.778890
Write this code--
var n=Math.round(1.778890*10)/10;
document.write(n);
If you want 2 decimal places then write 100 instead of 10 and if 3 decimal then 1000
And so on...(^_^)
+ 15
The JS Math round() is useful in this
Example:- Math.round(6.7);
Output:- 7
+ 8
that worked. thanks Buddy .
+ 7
@nikhil but I want the no. to be rounded off to three decimal points Math.round removes the decimal
Example :- 6.8937572817375
Round off :- 6.894