I want to round 1.7976 to 1.8. I've tried Math.round() and Math.float() but both give me 2 instead of what I want.
Asked
Active
Viewed 57 times
1 Answers
-1
var number = 1.7976;
var rounded = Math.round( number * 10 ) / 10;
console.log(rounded);

Jerome
- 734
- 1
- 8
- 28