Have you ever tried using the await inside forEach?
[].forEach(async(item) => {
await doSomethingWith(item)
})
Enter fullscreen mo...
For further actions, you may consider blocking this person and/or reporting abuse
Awesome article! If you were curious, you can add syntax highlighting to your code snippets by adding the language after the opening backticks like so:
which produces
You can also create your own helper function that does a similar job compared to
Array.prototype.forEach. Here using a function declaration to not pollute theArray.prototype.Not as sexy as polluting the
Array.prototypebut it does the trick as expected.Thank you! 🙏
Been there and done that!