I am doing some computations inside a double forEach
Loop something like this:
array.forEach(function(element){
Object.keys(element).forEach(function(key){
/* some complex computations with asynchronous callbacks */
});
});
someFunctionHere();
Is there a way for the Loop to finish first before doing the someFunctionHere( )
function? or any way that the program will know if the Loop is finish before continuing to someFunctionHere( )
...
I may be missing some forums but the ones I found did not helped me of what I want to achieve and by the way I am doing this in NodeJS , also I am asking if there are existing libraries that can make this happen.
I forgot to Add this up or should this be an another question?
Is there a way to do the iteration synchronously that it will only proceed to the next iteration once the current iteration is done? (Sorry for this)
Thanks for any help...
Clumpy.js
can also be used for this.) My answer shows how you can "roll your own" solution if, for some reason, you cannot (or simply do not want to) use third-party libraries. – Ted Hopp