Math 객체의 trunc() 함수는 숫자를 받아 정수점(소수 부분 제외)을 반환합니다. 주어진 숫자 자체가 정수인 경우 이 함수는 동일한 값을 반환합니다.
구문
구문은 다음과 같습니다.
Math.trunc();
예시
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script type="text/javascript">
var result = Math.trunc(58.745);
document.write("Integral part of the given number: "+result);
</script>
</body>
</html> 출력
Integral part of the given number: 58