Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JavaScript sleepsort
// JavaScript sleepsort
// by Evan Hahn (evanhahn.com)
// Port of this genius on 4chan:
// http://dis.4chan.org/read/prog/1295544154
// Call it like this:
// sleepsort(5, 4, 12, 8, 9, 10, 240);
function sleepsort() {
var i = arguments.length;
while (i --) {
setTimeout(function(n) {
console.log(n);
}, i, arguments[i]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment