Nomor JavaScript toExponential()
Contoh 1
Mengubah bilangan menjadi notasi eksponensial:
let num = 5.56789;
let n = num.toExponential();
Definisi dan Penggunaan
Metode toExponential() mengonversi angka menjadi notasi eksponensial.
Contoh 2
let num = 5.56789;
let n = num.toExponential(3);
Sintaksis
number.toExponential(x)
Parameter
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 |
Nilai Kembali
Sebuah String, mewakili nomor sebagai notasi eksponensial. |
Dukungan Peramban
Number.constructor
adalah fitur ECMAScript3 (ES3).
ES3 (JavaScript 1999) didukung penuh di semua browser:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |