JavaScript Number toExponential() method
- 이전 페이지 prototype
- 다음 페이지 toFixed()
- 上一层으로 돌아가기 JavaScript Number 참조 매뉴얼
definition and usage
toExponential()
the method converts the number to exponential notation.
instance
例子 1
let num = 5.56789; let n = num.toExponential(3);
例子 2
the number is converted to exponential notation:
let num = 5.56789; let n = num.toExponential();
syntax
number.toExponential(digits)
parameter
parameter | description |
---|---|
digits |
optional. 0과 20 사이의 정수로, 지수 계산법에서 소수점 자릿수를 정의합니다. 省略된 경우, 그 값을 나타내기 위해 필요한 자릿수로 설정됩니다. |
return value
type | description |
---|---|
string | represent the number in exponential notation. |
technical details
return value
Number의 문자열 표현을 반환합니다. 지수 계산법을 사용하여, 즉 소수점 앞에 1개의 숫자가 있고 소수점 뒤에 digits digit. 이 숫자의 소수점 부분은 지정된 길이에 도달하기 위해 반올림되고 필요에 따라 0으로 채워집니다.
throw
exception | description |
---|---|
RangeError |
when digits 너무 작거나 너무 크면 예외를 발생시킵니다. 0 ~ 20 사이의 값은 이 예외를 발생시키지 않습니다. 일부 구현은 더 넓은 범위나 더 좁은 범위의 값을 지원합니다. |
TypeError | 이 메서드를 호출하는 객체가 Number가 아니면 예외를 발생시킵니다. |
브라우저가 지원
Number.constructor
ECMAScript3 (ES3) 특성입니다.
모든 브라우저에서 ES3 (JavaScript 1999)을 지원합니다:
크롬 | IE | 에지 | 파이어폭스 | 사파리 | 오페라 |
---|---|---|---|---|---|
크롬 | IE | 에지 | 파이어폭스 | 사파리 | 오페라 |
지원 | 지원 | 지원 | 지원 | 지원 | 지원 |
- 이전 페이지 prototype
- 다음 페이지 toFixed()
- 上一层으로 돌아가기 JavaScript Number 참조 매뉴얼