28.Yes, This is Dog not printing



I'm having trouble with why this isn't printing to the console.
Can anyone help?

>  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();

Also, how do I edit this thing so that I stop getting the bold texts and red/blue texts in my post (the ones that aren't my code)


Your code works fine for me when I remove all the ">"s


I passed the lesson with the code, but it didn't print anything out for me. That's what I was asking. Did it print out for you?


Yes it did. I wasn't sure what you we're asking, so I just added my answer.


I had the same problem, but after refreshing the site it worked fine.


missing semicolon in your console.log


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