為什么需要用到call函數(shù)???
這個(gè)student不是已經(jīng)用Object。creat從 person那里繼承他的那些屬性了嗎?那為什么在這個(gè)student的那個(gè)函數(shù)那里還需要用到person.call那個(gè)玩意將person 的屬性復(fù)制過來呢???這個(gè)call不太懂
這個(gè)student不是已經(jīng)用Object。creat從 person那里繼承他的那些屬性了嗎?那為什么在這個(gè)student的那個(gè)函數(shù)那里還需要用到person.call那個(gè)玩意將person 的屬性復(fù)制過來呢???這個(gè)call不太懂
2016-10-11
舉報(bào)
2016-10-17
這里用call是為了使用student中的2個(gè)參數(shù)name,和age來調(diào)用構(gòu)造函數(shù)里的name和age,用call調(diào)用student里就不用在寫this.name=name,this.age=age了,如果還不懂的話你就上網(wǎng)查call和apply和bind的用法。