JavaScript-nummer toExponential()
voorbeeld 1
Zet een getal om in een exponentiële notatie:
let num = 5.56789;
let n = num.toExponential();
Definitie en gebruik
De methode toExponential() zet een getal om in een exponentiële notatie.
Voorbeeld 2
let num = 5.56789;
let n = num.toExponential(3);
Syntaxis
number.toExponential(x)
Parameters:
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 |
Winstwaarde
Een tekenreeks, die het getal voorstelt als een exponentiële notatie. |
Browserondersteuning
Number.constructor
is een ECMAScript3 (ES3)-functie.
ES3 (JavaScript 1999) wordt volledig ondersteund in alle browsers:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |