parseInt: 숫자 소수점 이하 제거 예제
<script type="text/javascript">
// 실수를 정수로 변환
var n = 123.99999999999999;
document.write(parseInt(n) + '<br />');
// 출력 결과: 123
// 그런데 123.999999999999999 로 9가 한 개 더 붙으면 124 가 됩니다.
// 실수를 정수로 변환
document.write(parseInt(123.0000001) + '<br />');
// 출력 결과: 123
// 정수도 정수로 변환
document.write(parseInt(123) + '<br />');
// 출력 결과: 123
// 숫자가 아닌 문자열로 된 실수도, 정수로 만듦
document.write(parseInt("666.4578") + '<br />');
// 출력 결과: 666
</script>
// 실수를 정수로 변환
var n = 123.99999999999999;
document.write(parseInt(n) + '<br />');
// 출력 결과: 123
// 그런데 123.999999999999999 로 9가 한 개 더 붙으면 124 가 됩니다.
// 실수를 정수로 변환
document.write(parseInt(123.0000001) + '<br />');
// 출력 결과: 123
// 정수도 정수로 변환
document.write(parseInt(123) + '<br />');
// 출력 결과: 123
// 숫자가 아닌 문자열로 된 실수도, 정수로 만듦
document.write(parseInt("666.4578") + '<br />');
// 출력 결과: 666
</script>
[출처] http://mwultong.blogspot.com/2006/12/javascript-float-to-int.html

