Javascript: how to avoid scientific notation when displaying large numbers

Based on http://users.dickinson.edu/~braught/courses/cs131s99/Lessons/03-Out&Data.html , for readability, JavaScript uses scientific notation to display very large numbers (the absolute value is greater than or equal to 1021), For example, record statement

document.write(1000000000000000000000000); 

will output 1e24

Can I avoid displaying scientific notation?

thanks

+2
source share
1 answer

This is not for readability. If an integer is greater than 2 53 (9007199254740992), then JavaScript cannot guarantee its exact storage. In your case, this number is actually 999999999999999983222784.

0
source

All Articles