function SuperType() {
this.colors = ["red", "blue", "green"];
}
function SubType() {}
SubType.prototype = new SuperType(); //继承方法
var instance1 = new SubType();
console.log(instance1.colors);
instance1.colors.push("black");
console.log(instance1.colors);
var instance2 = new SubType();
console.log(instance2.colors);
执行过后,明明只在instance1中的colors数组push一个black,为什么在instance2中会出现,不是又new出来一个新的对象了吗?而且原型中的方法会共享,但继承的对象中,colors属性存在SuoerType实例上呀,为什么会影响到instance2?求大神解答。