大神看下代码问题,为什么弹不出对话框!!
function inheritPrototype(sub, superType) {
var prototype = Object.create(superType.prototype);
prototype.constructor = sub;
sub.prototype = prototype
}
function superType(name) {
this.name = name;
this.colors = ['red', 'green']
}
superType.prototype.sayname = function() {
alert(this.name)
}
function sub(name, age) {
superType.call(this, name);
this.age = age
}
inheritPrototype(sub, superType);
sub.prototype.sayage = function() {
alert(this.age)
}
sub.prototype = new superType();
var instance = new sub("wong", 29)