Hello? Yes, This is dog error


#1

My code is correct and provides the correct output but it says it is incorrect.
Here is the code:

function Dog (breed) {
    this.breed = breed;
};

// add the sayHello method to the Dog class 
// so all dogs now can say hello
Dog.prototype.sayHello = function() {
  console.log("Hello, this is a " + this.breed + " dog");  
};

var yourDog = new Dog("golden retriever");
yourDog.sayHello();

var myDog = new Dog("dachshund");
myDog.sayHello();

The outputs are:
Hello, this is a golden retriever dog
Hello, this is a dachshund dog

I don't see the problem, but this has happened before where they just want a different answer.


#2

You have the wrong code for the exercise you are on.


#3

What? the error message says:
Oops, try again. It appears that your sayHello method doesn't properly log to the console 'Hello this is a [breed] dog' where [breed] is the breed of the Dog

but my code obviously does it


#4

Refresh zee browser and try again. zeeh code is correct.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.