I can't understand why the for loop does not work properly
for (x = 0; x < 10; x++) { 
url= 'http://capc-pace.phac-aspc.gc.ca/details-eng.php?project='+x;
urllib.request(url, function (err, data, res) {
    if (err || res.statusCode !=200) {
    }
    else{
    console.log(x);
    }
});
}
I always get this as my response
s452:scripts 04101frt$ node javascriptparser.js 
10
10
10
10
10
I would expect to get all the pages that don't have redirect (i.e. their numbers in their url's)
The amount of numbers turn out fine (5 in this case) but I want to have their proper value.
 
     
    