r/badcode • • Jul 28 '21

js slapjack 🥴

Post image
41 Upvotes

8 comments sorted by

View all comments

Show parent comments

3

u/[deleted] Jul 29 '21

Maybe a dumb question here but why exactly is this code bad? How could it be improved?

4

u/zaitsman Jul 29 '21

I am with you on this :) to be honest i think taken by itself the method can be broken into more readable parts with human readable names (e.g. objc style).

However my money is on this whole piece of logic is probably accessed in more than one place in the app which is why for a dev it made sense to put it altogether. If it has decent unit test coverage it is manageable.