Consider this code:
var http = require("http");
http.createServer(function(request, response) {
for (var i = 0; i < 1000000; i++) {
console.log("Request received");
}
response.writeHead(200, {
"Content-Type": "text/plain"
});
response.write("Hello World");
response.end();
}).listen(8888, "127.0.0.1");
If we run this code,we should wait for many minute too get response.But if run a for without console.log("Request received");in a for we get response with high speed?
Why?