求这两段闭包代码的运行机制,谢谢

var name = "The Window";

var object = {

    name :"My Object",

    getNameFunc : function(){

      return function(){

        return this.name;

      };

    }

  };

  alert(object.getNameFunc()()); 


var name = "The Window";

  var object = {

    name : "My Object",

    getNameFunc : function(){

      var that = this;

      return function(){

        return that.name;

      };

    }

  };

  alert(object.getNameFunc()());


qq_一梦两三年丶_0
浏览 1045回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript