I am a newbie in Node.js and still learning the basic syntax
I was wondering if we want to use two different JSON object and then compare their values before giving the output then how do we use forEach
in a nested manner like normal for
?
var count = 0;
app.locals.author.forEach(function(item)
{
app.locals.post.forEach(function(item1){
if(item.id == item1.userId)
{
count++;
}
});
res.send('Author = ' + item.name + " No of Posts done = " + count+"\n");
count = 0;
});