If you write multiple expressions separated by a comma (,
), then all expressions will be evaluated, but you will end up with the value of the last expression:
var x = (1,2,3);
console.log(x); // this will log "3"
Now (0,c.d)
is an expression that will return the function c.d
, but now c
is not the this
of the function anymore. This means that this
will point to the global object (window
), or remain undefined in strict mode. You would get the same effect with any of these:
var f = function(x) { return x; };
f(c.d)();
Or just
var f = c.d;
f();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…