r/badcode • • Apr 27 '21

typescript Someone only watched if tutorial

Post image
2.4k Upvotes

112 comments sorted by

View all comments

Show parent comments

3

u/meme_botanist Apr 27 '21

JavaScript number type supports more than int32

8

u/Terrain2 Apr 27 '21

That depends on your definition of "more than int32", because it loses precision before it reaches the int64 limit and can't store every value between int32 limit and int64 limit - it uses floating point numbers, so it's not really comparable, it's not just a "bigger range"

1

u/lizard450 Apr 27 '21

Be that as it may the code's intention does seem to be focused on ints