Số JavaScript thành hàm mũ()
ví dụ 1
Chuyển một số thành ký hiệu số mũ:
let num = 5.56789;
let n = num.toExponential();
Hãy tự mình thử »Sự miêu tả
Phương thức toExential() chuyển đổi một số thành ký hiệu số mũ.
Cú pháp
number .toExponential( x )
Thông số
Parameter | Description |
---|---|
x | Optional. An integer between 0 and 20 representing the number of digits in the notation after the decimal point. If omitted, it is set to as many digits as necessary to represent the value |
Giá trị trả về
Một Chuỗi, biểu thị số dưới dạng ký hiệu số mũ. |
Hỗ trợ trình duyệt
toExponential()
là một tính năng của ECMAScript3 (ES3).
ES3 (JavaScript 1999) được hỗ trợ đầy đủ trên tất cả các trình duyệt:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |