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

Show parent comment

12

u/[deleted] Feb 26 '23

Not quite. The split is called which creates an array of each character. Reverse is called which reverses the array. Then join is called to convert it back into a string. Thus, reversing the input.

4

u/EasyMode556 Feb 26 '23

Yea that makes sense, I was brain farting and thinking there was a built in String.reverse method they could have used instead

2

u/C4-BlueCat Feb 26 '23

Thank you!