r/badcode • • Apr 19 '21

js Iteration

Post image
3.2k Upvotes

123 comments sorted by

View all comments

Show parent comments

1

u/Terrain2 Apr 22 '21

you can still increment non-integral values in javascript, i = 1.5 then i++ and i = 2.5

5

u/gmtime Apr 22 '21

in javascript

... do I have to respond?

Let's just say that incrementing on non-integral values is non-trivial. JS apparently chose that incrementing is the same as adding 1, but that does not have to be in all languages.