28.Yes, This is Dog not printing


#1


----------

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)


#2

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


#3

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?


#4

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


#5

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


#6

missing semicolon in your console.log


#7

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