The toExponential() method formats a number to exponential notation.
SyntaxtoExponential([ fractionDigits ])
Returns a string representation of a number in exponential notation. The string contains one digit before the decimal point, and may contain fractionDigits digits after it.
If fractionDigits is not supplied, the toExponential method returns as many digits necessary to uniquely specify the number.
ExamplesUsing toExponential
to format the text presentation of a number.
var pie = 3.14159;
pie.toPrecision();
pie.toPrecision(3);
pie.toPrecision(1);
pie.toPrecision(0);
Remarks Throws
RangeError
when a fractionDigits outside the bounds of 0 - 20 (inclusive) was given.
15.7.4.6 Number.prototype.toExponential(fractionDigits)
ECMAScript® Language Specification Standard ECMA-262 5.1 Edition / June 2011
AttributionsMicrosoft Developer Network: Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4