2
How to decrease the decimals of a float number in javascript?
For example, I want 3.3333333333
become in 3.34
.
What is the simplest way to do this in javascript
?
I tried functions like Math.ceil
, but it returns me the whole value.
float_value = 3.333333;
Math.ceil(float_value); // 4
You can also use the
.toPrecision()
http://jsfiddle.net/cks2mvr9/– stderr
@qmechanik, you should post as an answer, to win +1, rsrsrsrsrsrsrs
– Wallace Maxters