JavaScript Math.floor()

StemsΒ·2022λ…„ 4μ›” 25일

JavaScript

λͺ©λ‘ 보기
5/6

Math.floor()

πŸ‘‰ μ†Œμˆ˜μ  λ‚΄λ¦Ό

✍ μ‚¬μš© μ˜ˆμ‹œ

Math.floor( 45.95); //  45
Math.floor( 45.05); //  45
Math.floor(  4   ); //   4
Math.floor(-45.05); // -46
Math.floor(-45.95); // -46

Math.ceil()

πŸ‘‰ μ†Œμˆ˜μ  올림

✍ μ‚¬μš© μ˜ˆμ‹œ

Math.ceil(1.6) : 2
Math.ceil(1.2) : 2
Math.ceil(1.0) : 1
Math.ceil(-1.2) : -1
Math.ceil(-1.6) : -1
Math.ceil(-2.0) : -2

Math.round()

πŸ‘‰ μ†Œμˆ˜μ  반올림

✍ μ‚¬μš© μ˜ˆμ‹œ

Math.round(1.6) : 2
Math.round(1.5) : 2
Math.round(1.2) : 1
Math.round(1.0) : 1
Math.round(-1.2) : -1
Math.round(-1.5) : -1
Math.round(-1.6) : -2
Math.round(-2.0) : -2

πŸ‘‰ μ°Έκ³  μ‚¬μ΄νŠΈ

profile
- Steadily, Don't Stop

0개의 λŒ“κΈ€