Skip to content

Instantly share code, notes, and snippets.

@isaacd9
Created September 16, 2017 19:20
Show Gist options
  • Save isaacd9/a1db302ac6ecf5a20e9f865ddb735303 to your computer and use it in GitHub Desktop.
Save isaacd9/a1db302ac6ecf5a20e9f865ddb735303 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);
});
};
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