'Finally' for forEach - Callback After All forEach are done running

In Promise there is a finally() - runs after all chains, error are done. Anything similar in Array.forEach() ? May be needed when you want to do something at the end of the async stuff that happens on each of the array elements - when all are done. This can be easily done by following: ref Using a basic counter function callback () { console.log('all done'); } var itemsProcessed = 0; [1, 2, 3]....

May 10, 2022 · 1 min · Anant