How to avoid scientific notation for large numbers in JavaScript?

后端 未结 22 2392
無奈伤痛
無奈伤痛 2020-11-22 00:31

JavaScript converts a large INT to scientific notation when the number becomes large. How can I prevent this from happening?

22条回答
  •  一个人的身影
    2020-11-22 01:14

    You can use from-exponential module. It is lightweight and fully tested.

    import fromExponential from 'from-exponential';
    
    fromExponential(1.123e-10); // => '0.0000000001123'
    

提交回复
热议问题