Javascript 中如何将科学记数法转换为扩展字符串?

How do you convert scientific notation to expanded string in Javascript?

例如:

// Current behaviour
1e+25.toString() // Becomes "1e+25"

// Want this instead
1e+25.toDecimalString() // Becomes "1000000000..."

您可以使用 toLocaleString() 方法。试试这个:

1e+25.toLocaleString("en-US", { useGrouping: false })
// Output: "10000000000000000000000000"