var request = require('request');
var cheerio = require('request');
var eval = "5555";
request('http://google.com', function (error, response, body) {
if (!error && response.statusCode == 200) {
var keys = body.split(",");
eval = keys[0]; // Think keys[0] is 7777
// and no problem in if statement, it must be excuted.
}
})
console.log("evalue :"+eval);
// result ---> 5555
Why the result is 5555? not 7777? I think eval is global value, and if statement will update eval value to 7777, and I think the result will be 7777 but I realize it doesn't. Can anyone tell me why. Sorry to similar question.