Skip to content

Instantly share code, notes, and snippets.

@Matt-Jensen
Created June 5, 2019 00:47
Show Gist options
  • Save Matt-Jensen/7979cc5bed0faf206628042c305ca3a0 to your computer and use it in GitHub Desktop.
Save Matt-Jensen/7979cc5bed0faf206628042c305ca3a0 to your computer and use it in GitHub Desktop.
(async () => {
const itterations = Array.from({length: 4});
console.log('starting');
itterations.map(async (_, i) => {
await wait(300);
console.log(`itteration done ${i}`);
});
await wait(100);
console.log('finishing');
})();
function wait(tm = 0) {
return new Promise(resolve =>
setTimeout(resolve, tm)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment