Skip to content

Instantly share code, notes, and snippets.

@lcherone
Created June 27, 2020 01:31
Show Gist options
  • Save lcherone/7474247d6f42f8e9dc7541226eff2718 to your computer and use it in GitHub Desktop.
Save lcherone/7474247d6f42f8e9dc7541226eff2718 to your computer and use it in GitHub Desktop.
asynchronous IIAFE in a for loop, with step timing
console.log('asynchronous IIAFE in a for loop, with step timing')
for (let i = 0; i <= 10; i++)
setTimeout(
async () =>
(async function (index) {
console.log(index)
})(i),
i * 250
)
console.log('yup, its async')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment