문제

I want to round both 130.68(greater than or equals 130.5) and 131.32(less than 131.5) values to 131.

도움이 되었습니까?

해결책

Use Math.round()

Math.round(130.68); // return 131
Math.round(131.32); // return 131

Fiddle Demo

다른 팁

You need to use Math.round(), In example below both statement will alert 131

alert(Math.round(130.68));
alert(Math.round(131.32));

DEMO

You can use Math.round

num=130.68; 
Math.round(num);

use this link:

Use Math.round()

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top