Skip to content

Instantly share code, notes, and snippets.

@isaacd9
Created September 16, 2017 19:18
Show Gist options
  • Save isaacd9/b44c4c38bda52f800dbe55fd3b2166d3 to your computer and use it in GitHub Desktop.
Save isaacd9/b44c4c38bda52f800dbe55fd3b2166d3 to your computer and use it in GitHub Desktop.
#!/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