Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions 7-objects/37-animal-farm.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const pig = {
type: "pig",
age: 63,
makeSound() {
console.log(pig.name + " is a " + pig.age + " year old " + pig.type + " that goes oink!");
return pig.name + " is a " + pig.age + " year old " + pig.type + " that goes oink!";
}
};

Expand All @@ -15,7 +15,7 @@ const sheep = {
type: "sheep",
age: 42,
makeSound() {
console.log(sheep.name + " is a " + sheep.age + " year old " + sheep.type + " that goes baaaah!");
return sheep.name + " is a " + sheep.age + " year old " + sheep.type + " that goes baaaah!";
}
};

Expand All @@ -24,10 +24,10 @@ const dog = {
type: "dog",
age: 12,
makeSound() {
console.log(dog.name + " is a " + dog.age + " year old " + dog.type + " that goes woof!");
return dog.name + " is a " + dog.age + " year old " + dog.type + " that goes woof!";
}
};

pig.makeSound();
sheep.makeSound();
dog.makeSound();
console.log(pig.makeSound());
console.log(sheep.makeSound());
console.log(dog.makeSound());