Skip to content

Instantly share code, notes, and snippets.

@radmen
Created July 16, 2012 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radmen/3122706 to your computer and use it in GitHub Desktop.
Save radmen/3122706 to your computer and use it in GitHub Desktop.
Js Sleep sort
// ported from http://dis.4chan.org/read/prog/1295544154
var numbers = [10, 3, 2, 6, 1, 5],
sleep_sort = function() {
var i = numbers.shift();
if(!numbers.length) {
return;
}
setTimeout(function() {
console.log(i);
}, i);
sleep_sort();
};
sleep_sort();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment