숫자관련객체1 [Javascript 기초] 숫자 관련 객체 Math 숫자 관련 객체 1. Math.round() 2. Math.pow() 3. Math.sqrt() 4. Math.abs() 5. Math.ceil() 6. Math.floor() 7. Math.min() 8. Math.max() 9. Math.random() 1. Math.round() Math.round(x)는 입력값 x에서 제일 근접한 정수를 반환합니다. (반올림, 반내림) console.log(Math.round(4.3)); // 4 2. Math.pow() Math.pow(x, y)는 x에 y를 제곱한 값을 반환합니다. console.log(Math.pow(2, 4)); // 16 3. Math.sqrt() Math.sqrt(x)는 x의 제곱근을 반환합니다. console.log(Math.sqrt(.. 2023. 5. 31. 이전 1 다음