我有以下
function mild_bird(){
this.name = "catherine";
this.origin = "st petersburg";
this.location = "brighton beach";
}
mild_bird.prototype.get_info = function(){
return "poo" + ", " + "pee";
}
function wild_bird(nickname){
this.nickname = nickname;
//anyway to reference parameters in mild_bird constructor's?
this.name = mild_bird.prototype.name;
this.origin = mild_bird.prototype.origin;
this.location = mild_bird.prototype.location;
}
wild_bird.prototype = new mild_bird();
wild_bird.prototype.constructor = wild_bird;
var the_wild_bird = new wild_bird("sandy");
alert(the_wild_bird.name);
最后一行的警报返回未定义。我希望它返回“凯瑟琳”。是否可以将mild_bird 的构造函数中的属性传递给wild_bird 的构造函数?