Reputation: 33901
I have a number which is displaying as follows:
1.0333333333333335e-9
I'd like to limit the number of digits that's shown, so it looks more like:
1.03e-9
How do I do this?
Upvotes: 3
Views: 96
Reputation: 207501
numObj.toExponential(fractionDigits)
has it built in
fractionDigits
An integer specifying the number of digits after the decimal point. Defaults to as many digits as necessary to specify the number.
Upvotes: 7