function Sup(){ this.name = 'adc'; this.arr = [1,2,3]; } Sup.prototype.say = function(){ console.log(this.arr) } function Sub(){ Sup.call(this) } Sub.prototype = Sup.prototype var c1 = new Sub() var c2 = new Sub()
這樣寫js繼承跟 js寄生組合式繼承相比會有什么問題嗎?
守候你守候我
2019-03-07 18:14:07