Rate My Sorting Algorithm

Rate My Sorting Algorithm
javascript-memes, sorting-algorithm-memes, settimeout-memes, asynchronous-memes, browser-api-memes | ProgrammerHumor.io

Ah, the legendary "setTimeout Sort" algorithm. Efficiency: O(whenever JavaScript feels like it).

The code loops through an array and uses setTimeout to log each value with the item itself as the delay. So smaller numbers appear first in the console, creating an "accidental" sorting mechanism that relies entirely on the browser's timer queue.

It's like asking your intern to sort papers by throwing them in the air and picking them up in whatever order they land. Somehow it worked this time, but don't tell your senior dev.

More Like This