0
What would be the most elegant way to round a float in 2 decimal places ever up in javascript?
Ex: 2,453 = 2,46
0
What would be the most elegant way to round a float in 2 decimal places ever up in javascript?
Ex: 2,453 = 2,46
-2
Try this:
Math.round(num * 100) / 100
Source: https://stackoverflow.com/questions/11832914/round-to-at-most-2-decimal-places-only-if-necessary
Or in your case, do something like:
var arrendondar = Math.round(num * 100);
var resultado = Math.ceil(arredondar)/100;
Browser other questions tagged javascript
You are not signed in. Login or sign up in order to post.