Goodsu

导航

 

疑问:在使用.call()时,调用对象到底是否可以直接拥有了被调用者的方法和属性?

这里输出结果为:ReferenceError: o is not defined

 

 

      function Person(name,age,job){
            this.name=name;
            this.age=age;
            this.job=job;
            this.sayName= function() {
                console.log(this.name);
            };
            return this;
        }

Person.call(o,"nike",20,"student");
o.sayName();

 

posted on 2015-08-12 00:30  Goodsu  阅读(127)  评论(0)    收藏  举报