-
-
Save isaacd9/a1db302ac6ecf5a20e9f865ddb735303 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); | |
}); | |
}; | |
const sort = (arr) => { | |
return Promise.all(args.map(sleep)); | |
}; | |
args = process.argv; | |
args.shift(); | |
args.shift(); | |
const sorted = []; | |
sort.then(() => console.log(sorted)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment