parseInt is meant for strings so it converts the number there into a string. Once the numbers get small enough it starts representing it with scientific notation. So 0.0000001 converts into "1e-7" where it then starts to ignore the e-7 part because that’s not a valid int, so it is left with 1
This one is one of my favourite JS quirks:
Wait wtf is happening there?
parseInt is meant for strings so it converts the number there into a string. Once the numbers get small enough it starts representing it with scientific notation. So
0.0000001
converts into"1e-7"
where it then starts to ignore thee-7
part because that’s not a valid int, so it is left with1
https://javascript.plainenglish.io/why-parseint-0-0000001-0-8fe1aec15d8b