[Javascript] Math 객체

lilclown·2022년 6월 17일
0

Javascript

목록 보기
22/42
post-thumbnail
post-custom-banner

Math 객체


Math.abs()

  • 절대값
console.log(Math.abs(-10)); //10

Math.min(), Math.max()

  • 최소값, 최대값
console.log(Math.min(1, 2, 3, 4, 5)); //1
console.log(Math.max(1, 2, 3, 4, 5)); //5

Math.round(), Math.ceil(), Math.floor()

  • 반올림, 올림, 내림
console.log(Math.round(0.5)); //1
console.log(Math.ceil(0.5)); //1
console.log(Math.floor(0.5)); //0

Math.pow()

  • 거듭 제곱
console.log(Math.pow(10, 2)); //100

Math.sqrt()

  • 제곱근
console.log(Math.sqrt(100)); //10



Tomorrow better than today, Laugh at myself

- 출처 -

profile
Tomorrow better than today, Laugh at myself
post-custom-banner

0개의 댓글