자바스크립트 Math.floor

자바스크립트 Math.floor

요약(Summary)
소수점을 가장 가까운 정수로 내림한 값을 리턴

문법(Syntax)
1.Math.floor(x)

예제(Example)

1
2
3
4
5
alert(Math.floor(5.1)); // number, 5
alert(Math.floor(5.9)); // number, 5
alert(Math.floor(5)); // number, 5
alert(Math.floor(-5.1)); // number, -6
alert(Math.floor(-5.9)); // number, -6

Share