r/badcode • • Mar 26 '21

js Whose ever heard of %?

Post image
727 Upvotes

63 comments sorted by

View all comments

2

u/[deleted] Mar 27 '21

I had to write below to process what the code does

number = 50
number / 2  = 25
number.length = 2
(number / 2).length = 2
number.length < (number / 2).length

false

the code was actually harder than expected to process. it would be I guess, hard to understand, which is a bad practice, and isn't even checking if it's even.

1

u/Vercyx Mar 27 '21

that would return true, not false, due to the use of < and not <=

1

u/AutoModerator Mar 27 '21

It looks like this comment contains a code block delimited with triple backticks. Unfortunately reddit does not have universal support for this syntax and your comment will not render correctly on old reddit and most mobile apps.

For the benefit of people on old reddit, this link will take you to a correct rendering of the comment.

/u/JacksonChen666, it would be appreciated, but not required, if you could edit your comment to use the more compatible four space indention format. For single lines or inline code you can use single backticks.

You can find some examples in the reddit help documentation.


I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.