Created
September 24, 2019 14:11
-
-
Save yuyoyuppe/3dfa4901571fbfb3ac6625340cded58e to your computer and use it in GitHub Desktop.
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
async function sleep_sort(a) | |
{ | |
let sorted = []; | |
await Promise.all(a.map(async e => { | |
await new Promise(resolve => setTimeout(resolve, e)); | |
sorted.push(e); | |
})); | |
return sorted; | |
} | |
const arrrrr = [5,3,1,10,7,2]; | |
console.log(await sleep_sort(arrrrr)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment