call()的第二个参数

js中,被继承的函数称为超类型(父类,基类也行),继承的函数称为子类型(子类,派生类)。

call()的第二个参数就是给超类型传参。

function parent(age){
    this.name = ['mick','mini','so']
    this.age = age;
}

function children(){
    Parent.call(this,age);//给超类型传参
}
 

猜你喜欢

转载自blog.csdn.net/weixin_42369486/article/details/81286802