this,你这么调皮,函数麻麻知道嘛?

来源:javascript高级程序设计

在几种特殊的情况下,this的值可能会意外改变。比如

var name="The Window";
var object={
   name:"The Object",
   getName:function(){
       return this.name;
   } 
};

object.getName();    //  "The Object"
(object.getName)();    //  "The Object"
(object.getName=object.getName)();    //  "The  Window"  在非严格模式下
放下过去,才能迎接未来! 未来的每一天我都要过的精彩!
原文地址:https://www.cnblogs.com/lilylearning1992/p/4760917.html