Skip to content

Instantly share code, notes, and snippets.

@brandonmp
Created November 18, 2016 20:37
Show Gist options
  • Save brandonmp/a7d610ef5a334e9f470ff37c2e8ee6a9 to your computer and use it in GitHub Desktop.
Save brandonmp/a7d610ef5a334e9f470ff37c2e8ee6a9 to your computer and use it in GitHub Desktop.
basically a sequential asynchronous 'foreach' replacement that uses async/await
async function main() {
for (let item of iterable) {
try {
const res = await fetch('http://www.example.com', { method: 'HEAD' })
} catch (e) {
console.error(e)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment