r/badcode •

[deleted by user]

[deleted] — view deleted post

0 Upvotes

18 comments sorted by

View all comments

Show parent comment

4

u/Svizel_pritula May 11 '20

Since it adds them all to an array, it has to be ordered best to worst, just like the resulting array is. I could have done it in reverse and used unshift instead of push. It goes through all of them anyway.

1

u/jormaechea May 11 '20

Do'h, you're right! Unshift looks like a better shitty solution...