javascript__[정수와 실수 판별, 원하는 소수점 자릿수로 반올림]

Jaewon Lee·2021년 6월 1일
0

Javascript

목록 보기
12/12
post-thumbnail

On.


정수와 실수 판별


isInteger

let num1 = 1;
let num2 = 2.2;

>>
Number.isInteger(num1) //true
Number.isInteger(num2) //false

원하는 소수점 자릿수로 반올림하기


Math.round(숫자)

let num = 24.14567
(Math.round(num * 100) / 100)

>>
24.15

실수형숫자.toFixed(자릿수)

let num = 24.14567
num.toFixed(2)

>>
24.15

Off.


프론트와 백을 넘나드는 리드 개발자가 되는 그날까지 🔥🔥🔥

profile
Communication : any

0개의 댓글