Skip to content

Instantly share code, notes, and snippets.

@joelibaceta
Last active April 18, 2019 21:41
Show Gist options
  • Save joelibaceta/be4718c82244024fdca38562dc84f7be to your computer and use it in GitHub Desktop.
Save joelibaceta/be4718c82244024fdca38562dc84f7be to your computer and use it in GitHub Desktop.
"Sleep Sort" a funny approach about sort algorithms
numbers = [8, 42, 38, 111, 2, 39, 1]
numbers.forEach(num => {
setTimeout(() => { console.log(num) }, num)
});
// ➜ ~ node sleepsort.js
// 1
// 2
// 8
// 38
// 39
// 42
// 111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment