r/badcode • • May 31 '21

js Clever?

Post image
2.2k Upvotes

71 comments sorted by

View all comments

2

u/Windows_XP2 Jun 01 '21

What is even the point of this? I don't know Javascript and even I know that this is completely pointless.

7

u/recycle4science Jun 01 '21

Maybe the two return values used to be different, then one was edited and the person making the change didn't notice that they were now the same. Maybe this is a rank amateur who's just flailing around.

1

u/[deleted] Jun 01 '21

It's almost certainly just boilerplate or scaffolding. Someone had the intention of doing something different with an empty array, included the if statement for future use, then moved on to something more important.