Can I run a loop (while, for, dowhile etc) in a callback function. Here is a sample code :
var execute = function (data,callback)
{
//do something with data
callback();
}
execute (data,function(error,returnDataArray)
{
var boo = true;
while(boo)
{
//do something with returnDataArray
if (returnDataArray.length == 10)
boo=false;
}
});
Now, my doubt is, does the main node.js thread wait until the above while loop is executed?