자바스크립트 참고

Math.round() - 반올림

등록일 : ,

Math.round()

입력한 값을 반올림한 정수를 반환합니다.

자바스크립트

Math.round(0.4); // 0
Math.round(0.5); // 1
Math.round(1.4); // 1
Math.round(1.5); // 2

Math.round(-0.5); // -0
Math.round(-0.6); // -1
Math.round(-1.5); // -1
Math.round(-1.6); // -2

Math.round(0.4) == Math.round(-0.5) // true
방문해 주셔서 감사드립니다 !!