r/programminghorror
•
u/Leonnee
•
Jun 12 '25
•
1
Javascript Javascript is filled with horror
2.4k
Upvotes
View all comments
Show parent comment
1
u/Altruistic-Formal678 Jun 14 '25
What it should do ? Mostly in this case, it is use to round number. But really it is not really used with decimals like this.
In this case: Integer.parse expect a string, so it parse 0.0000005 to string, which is "5.10e-7" and Integer.parse("5.10e-7") only takes the last character that is number, thus 7