为了账号安全,请及时绑定邮箱和手机立即绑定

如何解决this的指向问题

如何解决this的指向问题

叮当猫咪 2018-10-11 14:14:08
function schema(arg1,arg2) {    return this.init.call(this,arg1,arg2);}schema.prototype={    init:function(a,b){        this.a=a;        this.b=b;        this.arr=[];    },    test:function(){        $(".selector").each(function () {            var tt=$(this).text();            //我想把遍历循环出来的值 tt push到 arr中   应该怎么写(或者说怎样才能使this指向schema)        })    }}var schemaObj=new schema(1,2);
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 549 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信