call和apply的用法。
//实现一个继承父类构造函数
function Super(name){ this.name=name; this.showName = function(){ console.log(this.name); } } function Sub(name){ Super.call(this,name); //Super.apply(this,arguments); } var s = new Sub("superboo"); s.showName();
相关推荐
chunianyo 2020-06-04
xjp 2020-05-26
owilson 2020-05-07
Alanxz 2020-03-04
wangyayun0 2020-02-11
歆萌 2020-02-10
chunianyo 2019-12-18
chunianyo 2019-12-12
APCDE 2019-12-10
herionliu 2017-09-02
herionliu 2018-06-01
ififg 2018-06-01
zheglei 2017-09-02
herionliu 2015-07-08
zheglei 2015-04-23
bossbusy 2014-11-21