<script type="text/javascript">
var a={
b:{
m:function()
{
console.log(this.p);
},
p:'hello'
}
};
var hello=a.b.m;//将a对象中的b对象中的m对象中的函数整体赋给hello变量。
hello();//此时这个函数为普通函数,上述的this指向Windows窗口,运行结果为undefined。
var hello=a.b;//将a对象中的b对象赋给hello变量.
hello.m();//此时这个函数为hello对象上(也就是b对象)的,上述的this指向b对象,运行结果为hello.
</script>
this指向:普通函数中的this指的是window,对象的绑定函数和构造函数中的this指的是当前对象