28. hello this is a dog. Advances, but won't print


#1

Here's 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();

It advances, but does not print; however, it does print at https://repl.it/languages/.

Should I just keep going and not overthink it?

thanks in advance,
Chris


#2

@shubanshii,

++++ reset of session *****************
As you are manipulating with objects
under certain circumstances you can shoot your Browser in an
inconsistent state.

Therefor it is of an advantage to know that you have 2 reset facilities:

One is the use of the F5-key which does a refresh Browser

and

Two, select&copy your code
Then use the Reset Code button of the course-window,
then paste your code back in.

Addendum
General Notes:
Always refresh the browser after making corrections:
CTRL f5 ( if on Windows or Linux)
CMD r ( if on a MAC).
CTRL 0 to reset browser zoom


#3

Thats my code :

It prints but doesn't allowed me to move on, I'm almost done :smirk:


#4

When I remove "this" from "this.breed" then it allowed me to pass but doesn't print text in the compailer


#6

//console should be exactly like this to work 100%, no need for refresch even:

console.log("Hello this is a" + " " + this.breed + " "+ "dog")


#7

just add this,

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

you have syntax err


#8

Thank you leonhard.wettengmx.n, for your general information about resetting and zoom


#9

Just try this. It's working.

console.log("Hello this is a"+" "+this.breed+" "+"dog");


#10

console.log("Hello this is a " + this.breed + " dog");

Make sure to input a space after a like this "a " and before dog like this " dog".