Created
October 17, 2019 20:50
-
-
Save mattiaerre/9c12c8e642d2f84d187c83189a3a5d2d 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 asyncForEach(array, callback) { | |
for (let index = 0; index < array.length; index += 1) { | |
// eslint-disable-next-line no-await-in-loop | |
await callback(array[index], index, array); | |
} | |
} | |
// credit to https://codeburst.io/javascript-async-await-with-foreach-b6ba62bbf404 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment