在javascript中将指数表示法小数位数限制为4 [英] limit the exponential notation decimal place to 4 in javascript
本文介绍了在javascript中将指数表示法小数位数限制为4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用此类值在javascript中将小数位限制为4? e是指数,因为我使用十个值的幂。 toFixed()
似乎不起作用。
How to limit the decimal place to 4 in javascript with this type of values? the e is the exponent since I am using power of ten values. toFixed()
doesn't seem to work.
1.0531436913408342e-7
-5.265718456704172e-7
8.425149530726674e7
推荐答案
尝试:
Math.round(val*10000)/10000
这篇关于在javascript中将指数表示法小数位数限制为4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文