I'm new in javascript and now i'm learn about express.js, but i get some code that makes me confused about how they work. I was tring to figure out how this code work but i still don't get it:
var server = app.listen(3000, function (){
var host = server.address().address;
var port = server.address().port;
console.log('Example app listening at http://%s:%s', host, port);
});
My question is how this anonymous function can using the server variable, when the server variable getting return value from app.listen()
.