I tested the scope of 'this' keyword, in nodejs:
color = 'red';
var o = {
    color: 'blue'
};
function say() {
    console.log(this.color);
};
say.apply(this);  //'undefined'
say.apply(global);//'red'
In browser:
color = 'red';
var o = {
    color: 'blue'
};
function say() {
    alert(this.color);
};
say.apply(this);  //'undefined'
say.apply(window);//'red'
var color = 'red';
function say() {
  alert(this.color);
}
say.apply(this);   //'red'
say.apply(window); //'red'The result is a bit weird to me: as long as "this" is a pointer to "global" or "window", why say.apply(this) will output 'undefined'?
Thanks.
 
     
     
    