I want to print the value of var a
outside the function call. If I run this program, it prints undefined
.
var http = require('http');
var foo = function(req, res){
var a = xyz('5',function(aa){
console.log(aa);
return aa;
});
res.end(a);
console.log(a);
}
function xyz(arg,callback){
var aa = 55;
return callback(aa);
}
http.createServer(foo).listen(8000);
console.log('start server');