node.js - node 回调函数中 var temp = this 的意义
PHPz
PHPz 2017-04-17 16:02:27
0
2
552
PHPz
PHPz

学习是最好的投资!

reply all(2)
Peter_Zhu

See notes:

this is req, which is a streamthis is req, which is a stream

此时this指向req,而req对外可以当做是stream

At this time, this points to req, and req can be used as stream externally, just changing the name , it seems clearer, it has no special meaning. 🎜
迷茫

I can only say that this demo is poorly written, and there is no need to be superstitious and overly speculate on its intentions.


Normal similar writing is like this

var xx = function() {
    var that = this;
    
    return funtion() {
        that.xxx
    }
}

You can reference this in the upper scope in the closure

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template