728x90

✨ '1.23'과 같이 소수점과 함께 있는 수를 올림 해주는 helper method

💻Example Code

const floatNum = 1.23;
const minFloatNum = -7.5;

console.log( Math.ceil(floatNum) );
console.log( Math.ceil(minFloatNum) );

실행 결과

😋 소수점 올림을하여 정수(Integer)가 필요할 때, 편리하게 사용할 수 있다. 자주 쓰이는 method.

👉 자세한 내용은 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/ceil

 

Math.ceil()

The Math.ceil() function always rounds a number up to the next largest whole number or integer.

developer.mozilla.org

 

'JavaScript > Built-in Method etc.' 카테고리의 다른 글

Math.pow()  (0) 2020.01.22
Math.random()  (0) 2020.01.18
Array.prototype.filter()  (0) 2020.01.11
Array.prototype.map()  (0) 2020.01.11
Array.prototype.push()  (0) 2020.01.06

+ Recent posts