How to avoid scientific notation for large numbers in JavaScript?

后端 未结 22 2078
無奈伤痛
無奈伤痛 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 00:52

    I had the same issue with oracle returning scientic notation, but I needed the actual number for a url. I just used a PHP trick by subtracting zero, and I get the correct number.

    for example 5.4987E7 is the val.

    newval = val - 0;
    

    newval now equals 54987000

提交回复
热议问题