I have a couple of code about some logic.
My following code block working as expected so willbeUpdated
variable couldn't updated literally in syncronized way.
var willbeUpdated = 1;
anArray.forEach(function(i){
getPromisedData(i).then(function(d){
willbeUpdated += d;
});
});
if (wiillbeUpdated == something) {
// some logic
}
So question is that, Do I have to create again another promised method for that foreach logic and put outside if logic
its then method, will be a best practise, or any other preferable idea in this situation ?
Edit: I asked this question to hear best or better approaches about nested async function handling instead of exact code blocks, thanks.