MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/g8xvwv/deleted_by_user/fq92slh/
r/badcode • u/[deleted]
[deleted] — view deleted post
18 comments sorted by
View all comments
Show parent comment
4
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.
unshift
push
1 u/jormaechea May 11 '20 Do'h, you're right! Unshift looks like a better shitty solution...
1
Do'h, you're right! Unshift looks like a better shitty solution...
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
unshiftinstead ofpush. It goes through all of them anyway.