레퍼런스 round()

round()

어떤 숫자에 가장 가까운 정수를 계산합니다.

예를 들어, round(133.8)는 134라는 값을 반환합니다.

두번째 매개변수인 decimals은 선택 사항입니다. 반올림할 때 사용할 소수점의 자리 수를 설정합니다. 예를 들어, round(12.34, 1)은 12.3을 반환합니다. decimals의 기본값은 입니다.

예제

구문

round(n, [decimals])

매개변수

n

반올림할 숫자

decimals

반올림할 소수점 자리 수 (기본값 0)

Notice any errors or typos? Please let us know. Please feel free to edit src/math/calculation.js and open a pull request!

관련 레퍼런스