How do I get the last line to work?
function Animal(name){
this.name = name;
}
Animal.prototype.speak = function(){
alert('Hi, I\'m ' + this.name);
}
function Dog(name){
this.name = name;
}
Dog.prototype.bark = function(){
alert('Woof!');
};
var fido = new Dog('Fido');
fido.bark(); // Woof!
fido.speak(); // Hi, I'm Fido *can't get this to work*