Math.round(25.9) //returns 26Math.round(25.2) //returns 25Math.round(-2.58) //returns -31) //round "original" to two decimals
var result=Math.round(original*100)/100 //returns 28.452) // round "original" to 1 decimal
var result=Math.round(original*10)/10 //returns 28.53) //round 8.111111 to 3 decimals
var result=Math.round(8.111111*1000)/1000 //returns 8.111Fonte da Descoberta: http://wsabstract.com/javatutors/round.shtml
Nenhum comentário:
Postar um comentário