28/30: Is this a bug or am I doing something wrong here?


For this exercise, if I use this.breed (as I should) I receive an error, but if I use breed (which is, by my understanding, incorrect) I pass the exercise?

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 " + this.breed + " dog"); // supposedly correct usage that gives me an error

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

var myDog = new Dog("dachshund");

If instead I use breed then I receive ReferenceError: breed is not defined but the exercise says Way to Go!

"Hello this is a " + this.breed + " dog"

Doesn’t change the outcome.

Odd. I added the missing a to the phrase and passed. Before adding the a I got an error message saying that sayHello didn’t output the correct phrase.

Okay, so adding the a did allow my code to pass. So my bad on that one. However, 1. the output didn’t show up in the console and 2. the incorrect code of just using breed still passes, even though the console throws an error. I used 2 different browsers.

(My method is to test this is to reset the code, click the button to submit exercise, get an error, paste in the code I’m testing, submit again.)

I’m going to shift this topic to the Platform category for the folks upstairs to see. The SCT might need some work.