함수2 javascript round 반올림 ( 올림, 내림 처리 방법 ) 소수점 javasciprt 기본 네이티브 lib 에서 Math object의 round, ceil, floor를 사용하면 된다. 반올림 Math.round(2.4); => 2 Math.round(2.49); => 2 Math.round(2.5); => 3 Math.round(2.51); => 3 올림 Math.ceil(2.1) =>3 Math.ceil(2.6) =>3 내림 (버림) Math.floor(2.1); => 2 Math.floor(2.6); => 2 Click the button to round the number 2.5 to its nearest integer. Try it //클릭시 myFunction 함수 실행 결과 : Try it 버튼 클릭 시 3 2020. 12. 23. setInterval 함수 주기적실행 ( 실시간 시간표시 예제 ) setInterval 함수는 특정함수를 주기적으로 실행할때 사용한다. setInterval ( 함수명, 시간 ) ; 다른 설명이 필요 없을것 같다. A script on this page starts this clock: 결과 A script on this page starts this clock: 오전 10:53:14 2020. 12. 23. 이전 1 다음