Skip to content

Instantly share code, notes, and snippets.

@stctheproducer
Last active December 17, 2020 16:33
Show Gist options
  • Save stctheproducer/670a424e6b23a540c5a3f246bba61bb7 to your computer and use it in GitHub Desktop.
Save stctheproducer/670a424e6b23a540c5a3f246bba61bb7 to your computer and use it in GitHub Desktop.
A JavaScript asyncronous forEach function to use when working with asynchronous functions and arrays
export const async function asyncForEach(array, callback) {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment