Convert exponential number to a whole number in javascript

后端 未结 4 1440
执念已碎
执念已碎 2021-01-20 18:17

I am in need use 23 digit number in a url. I am generating number using Math.random() but I get the result in exponential form.

My code is

var id =          


        
4条回答
  •  -上瘾入骨i
    2021-01-20 19:06

    JavaScript numbers are not precise enough for that. You will never be able to get full 23 random digits. It would be easier getting a several smaller numbers and pasting them together as a string.

提交回复
热议问题