JavaScript-nommer na Eksponensiële()
Voorbeeld 1
Skakel 'n getal om in 'n eksponensiële notasie:
let num = 5.56789;
let n = num.toExponential();
Definisie en gebruik
Die toExponential() metode omskep 'n getal in 'n eksponensiële notasie.
Voorbeeld 2
let num = 5.56789;
let n = num.toExponential(3);
Sintaksis
number.toExponential(x)
Grense
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 |
Terugkeerwaarde
'n String, wat die getal as 'n eksponensiële notasie voorstel. |
Blaaierondersteuning
Number.constructor
is 'n ECMAScript3 (ES3) kenmerk.
ES3 (JavaScript 1999) word ten volle in alle blaaiers ondersteun:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |