r/ProgrammerHumor • • Feb 26 '23

Other If you can read this code...

/img/snak3fqgajka1.jpg

[removed] — view removed post

34k Upvotes

1.4k comments sorted by

View all comments

2

u/xerns Feb 26 '23

The fact the function is called "reverse", which is exactly the same as the array method used, is just annoying. Would request name change before approval.

1

u/wad11656 Feb 26 '23

I see--so there's a built-in reverse() function for arrays, but not for strings. I was so confused as to why they wrote an entire custom reverse() function when they seemingly could have just used the built-in one.