call
call改变this的指向
call(‘第一位一定要传改变this指向的人’,q,w)
function Person(name, age, sex){
this.name = name;
this.age = age;
this.sex = sex;
}
function Student(name, age, sex, tel, grade){
//var this = {}
Person.call(this, name, age, sex);
this.tel = tel;
this.grade = grade;
}
var Student = new Student('qw', 21, 'male', 123456789, 2018);
apply
apply里面只能传一个arguments
apply( ‘第一位一定要传改变this指向的人’, [a,b])