Skip to content

Instantly share code, notes, and snippets.

@Xpktro
Created June 10, 2016 01:57
Show Gist options
  • Save Xpktro/3f86d60f1ecca00df76bec42e7b8579a to your computer and use it in GitHub Desktop.
Save Xpktro/3f86d60f1ecca00df76bec42e7b8579a to your computer and use it in GitHub Desktop.
Sleep Sort in JS
function sleepsort(numbers) {
numbers.forEach(function(number) {
setTimeout(function(){console.log(number)}, number)
})
}
sleepsort([2, 1, 3, 4, 6, 5, 7])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment