var http = require('http'); //1、正常逻辑第一步正常请求,动作进行一次的方法; function seqRequest(i,limit){ var req = http.get({host:'www.baidu.com', port:80, path:'/',agent:false},function(res) { resultdata = ''; res.on('data',function(chunk) { resultdata += chunk; }); res.on('end',function() { console.log(i) console.log('return ' + resultdata.length); //2、加入循环条件 if(i<limit){ //3、继续执行里面加入自增 seqRequest(i+1,limit) } }); }); req.on('error',function(err) { console.log('problem with request: ' + err.message); }); } seqRequest(0,10)