how to stop Javascript forEach?
I'm playing with Node.js and Mongoose — trying to find specific comment in deep comments nesting with recursive function and within. Is there a way to stop Node.js ? As I understand every iteration is a function and and I can't just do , only but this won't stop .forEach
forEach
forEach
break
return
forEach
function recurs(comment) {
comment.comments.forEach(function(elem) {
recurs(elem);
//if(...) break;
});
}