Last active
April 18, 2019 21:41
-
-
Save joelibaceta/be4718c82244024fdca38562dc84f7be to your computer and use it in GitHub Desktop.
"Sleep Sort" a funny approach about sort algorithms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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