My objective with the code snippet below is to exit FOR LOOP B and continue with FOR LOOP A by utilizing a callback function.
for(var a of arrA) {
// ...
// ...
for(var b of arrB) {
// ...
// ...
PartService.getPart(a.id, function(err, returnObj) {
break;
});
}
}
Is this approach going to yield the desired results? If not, what alternative method should I employ?
UPDATE: 4/28/16 3:28 MST
- The callback function operates asynchronously as confirmed
Considering the feedback from one of the responses and various comments provided below, sticking to the original context of my question, perhaps the revised inquiry at this stage ought to be "How can I integrate a synchronous callback function in Node.js?". Although I am contemplating restructuring my code to eliminate for loops, I am still interested in exploring the possibility of using synchronous callback functions. While I am aware that Underscore.js employs synchronous callback functions, the implementation process remains unknown to me.