Rounding up float in javascript [duplicate]

0

What would be the most elegant way to round a float by 2 decimal places always up in javascript?

Ex: 2.453 = 2.46

    
asked by anonymous 25.05.2017 / 22:32

1 answer

-2

Try this:

Math.round(num * 100) / 100

Source: link

Or in your case, do something like:

var arrendondar = Math.round(num * 100);
var resultado = Math.ceil(arredondar)/100;
    
25.05.2017 / 22:37