3

我有一个显示如下的数字:

1.0333333333333335e-9

我想限制显示的位数,所以它看起来更像:

1.03e-9

我该怎么做呢?

4

1 回答 1

7

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.

于 2013-10-22T17:40:12.913 回答