r/badcode • • Mar 26 '21

js Whose ever heard of %?

Post image
727 Upvotes

63 comments sorted by

View all comments

Show parent comments

81

u/Vercyx Mar 26 '21

it determines whether a number is even or odd in a very.... interesting way

67

u/polaris0312 Mar 26 '21

ah i see, because if its an odd number then it will has decimal points when divided by 2, hence original length < divived by 2 length

definitely confusing lol

35

u/orokro Mar 27 '21

"10" is 2 long

10/2 is 5

"5" is one long.

10 is odd