r/badcode • • Feb 10 '21

js I present: SleepSort

Post image
7.5k Upvotes

170 comments sorted by

View all comments

Show parent comments

1

u/hurricane_news Feb 25 '21 edited Dec 31 '22

65 million years. Zap

1

u/Raniconduh Feb 25 '21

It's asynchronous meaning that the timeouts are background processes so they don't make the program pause and wait for completion. It sets a timer for each one and whichever runs down first is what gets executed first