Skip to content

Instantly share code, notes, and snippets.

@danhab99
Created April 19, 2019 03:10
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 danhab99/63b3760a40084007572c6e7217d60946 to your computer and use it in GitHub Desktop.
Save danhab99/63b3760a40084007572c6e7217d60946 to your computer and use it in GitHub Desktop.
The worst thing ever
const sleepsort = (arr, callback) => {
for (var a in arr) {
setTimeout((i) => callback(i), a, a);
}
}
let test = [39, 9, 34, 26, 3, 30, 31, 18, 21, 3, 38, 7, 13, 16, 27, 21, 18, 8, 8, 38, 2, 11, 29, 11, 22, 28, 22, 9, 12, 0, 18, 2, 30, 29, 14, 23, 27, 38, 22, 22]
sleepsort(test, i => console.log(i));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment