반응형 number1 [JavaScript] 학습정리 - 9.Number 객체 이번에는 Number 객체에 대하여 알아보자. Number 객체에서 사용하는 메서드에는 주로 값에 대한 변환하는 기능을 갖고 있다. toExponential: 소수점 이하의 숫자 개수로 지수표현 toPrecision: 표현하는 유효숫자 toFixed: 소수점 이하 자릿수만 남기고 반올림하여 표시 var value = new Number(123.456789); value.toExponential(3) // 1.235e+2 value.toPrecision(4) // 123.5 value.toFixed(3) // 123.457 number.toExponential(fractionDigits) toExponential 메소드는 숫자를 지수 형태의 문자열로 변환합니다. console.log(Math.PI.toEx.. ■ Front-End ■/JavaScript 2023. 3. 1. 이전 1 다음 728x90