开发者

Javascript convert huge float to string [duplicate]

开发者 https://www.devze.com 2023-04-08 18:46 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: How to avoid scientific notation for large numbers in javascript?
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How to avoid scientific notation for large numbers in javascript?

Javascript: how to avoid scientific notation when displaying large unumber

I have this code:

var f = 1000000000000000000000; // 1e+21
var fstr = f.toString(); // return "1e+21"

But I don't need scientific number representa开发者_运维百科tion. I want to get "1000000000000000000000" in 'fstr' variable. How I can get it?


You can find an util script here:

http://snippets.dzone.com/posts/show/2206

There is also a short example at the bottom of the page.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号