function subType(){ this.addColor = [1,2,3,4,5,6]; } subType.prototype.showMess = function(){ console.log(this.addColor) } function type(){ subType.call(this) } type.prototype = new subType subType {addColor: Array[6]} var t = new type undefined t.addColor [1, 2, 3, 4, 5, 6] t.showMess() VM10694:5 [1, 2, 3, 4, 5, 6] undefined t.addColor.push(333) 7 t.showMess() VM10694:5 [1, 2, 3, 4, 5, 6, 333] undefined var t2 = new type undefined t2.addColor [1, 2, 3, 4, 5, 6] t2.showMess() VM10694:5 [1, 2, 3, 4, 5, 6]
时间: 2024-09-29 23:21:43