Object Constructor

function Dog (name, breed, weight) {
this.name = name;
this.breed = breed;
this.weight = weight;
this.bark = function() {
if (this.weight > 25) {
console.log(this.name + " says Woof!");
} else {
console.log(this.name + " says Yip!");
}
};
}

var fido = new Dog (“Fido”, “Mixed”, 38);
var fluffy = new Dog (“fluffy”, “Poodle”, 30);
var spot = new Dog (“Spot”, “Chihuahua”, 10);

console.log(fido.bark());
console.log(fluffy.bark());
console.log(spot.bark());

Would like to know if this is the correct way to log.

@CoastlineProduction Welcome to the forum.

Please, write your code between a pair of backsticks for better visualization.

Your console.log() seems to work, although is redundant.

function Dog (name, breed, weight) {
this.name = name;
this.breed = breed;
this.weight = weight;
this.bark = function() {
if (this.weight > 25) {
console.log(this.name + " says Woof!");
} else {
console.log(this.name + " says Yip!");
}
};
}

var fido = new Dog (“Fido”, “Mixed”, 38);
var fluffy = new Dog (“fluffy”, “Poodle”, 30);
var spot = new Dog (“Spot”, “Chihuahua”, 10);

console.log(fido.bark());
console.log(fluffy.bark());
console.log(spot.bark());

The issue, I am having is that I am unable to log this code using sublime text with Safari, chrome and firefox. It works when i use a web inspector but it comes up with an undefined value after each log. It also works when I use alert in the method instead of console log and change the function call at the bottom with fido.bark(); etc but the undefined value still comes up but this time only once.

Thanks for responding i really appreciated!

Replace the quotes again. Notice that they are not recognized as string. Their color must be red. That is, “Fido” is not same "Fido"

When you write var variableX = 1000;, the browser console returns undefined. This behavior is normal. If you write variableY = 2000;, then browser console returns 2000.

In line lines below you are logging the the returned result of the bark function. This function does not return anything hence it logs undefined

console.log(fido.bark());
console.log(fluffy.bark());
console.log(spot.bark());

You don’t need the 2nd set of console logs. Simply call the function

fido.bark()
fluffy.bark()

The function takes care of the loging. Also as @yoelvis pointed out you need to fix the inverted commas

Thanks a lot guys! But it looks like both of my current browser are malfunctioning and aren’t rendering the code. Firefox and Safari, it could be that something needs to be be enabled or disabled not sure yet. I’ll keep searching! Thanks again.

Try with google chrome - there are known incompatibilities with most browsers

I did but same results, will examine the settings next and see if it works. Thanks again!