var A=function(){
        this.m=10;
        return 20;
    }
    var aa=new A();
    alert(aa.m);

 

var A=function(){
        this.m="this is it";
        var that={};
        that.name="that is that";
        return that;
    }
    var o=new A();
    alert(o.m);

答案就很明显了~第一个是10 因为未返回对象,所以默认返回function对象(this指向Function)

第二个是未定义,因为返回的是对象,对象里木有m

 

转自:http://99jty.com/?p=542

相关文章:

  • 2021-10-16
  • 2021-06-15
  • 2019-06-21
  • 2021-09-10
  • 2021-06-23
  • 2021-11-15
  • 2021-06-16
  • 2021-08-28
猜你喜欢
  • 2022-12-23
  • 2021-06-21
  • 2021-12-04
  • 2021-04-28
  • 2021-11-28
相关资源
相似解决方案