-
-
Save isaacd9/b44c4c38bda52f800dbe55fd3b2166d3 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/local/bin/node | |
const sleep = (strNum) => { | |
return new Promise((resolve, reject) => { | |
num = parseInt(strNum); | |
setTimeout((num) => { | |
sorted.push(num); | |
resolve(); | |
}, num, num); | |
}); | |
}; | |
args = process.argv; | |
args.shift(); | |
args.shift(); | |
const sorted = []; | |
Promise.all(args.map(sleep)).then(() => console.log(sorted)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment