Skip to content

Commit 1aec5c8

Browse files
committed
ft(finish and clean up code base)
1 parent 1c4ca3f commit 1aec5c8

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

‎assignments/prototypes.js‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function GameObject(attributes) {
2424
}
2525

2626
GameObject.prototype.destroy = function () {
27-
console.log(`${this.name} was removed from the game.`);
27+
return `${this.name} was removed from the game.`;
2828
}
2929

3030
let newGame = new GameObject({
@@ -36,8 +36,6 @@ let newGame = new GameObject({
3636
}
3737

3838
});
39-
console.log(newGame);
40-
console.log(newGame.destroy());
4139

4240
/*
4341
=== CharacterStats ===
@@ -53,7 +51,7 @@ function CharacterStats(attributes) {
5351
CharacterStats.prototype = Object.create(GameObject.prototype);
5452

5553
CharacterStats.prototype.takeDamage = function () {
56-
console.log(`${this.name} took damage.`);
54+
return `${this.name} took damage.`;
5755
}
5856

5957
let newCha = new CharacterStats({
@@ -66,8 +64,7 @@ let newCha = new CharacterStats({
6664
healthPoints: '99'
6765

6866
});
69-
console.log(newCha);
70-
console.log(newCha.takeDamage());
67+
7168
/*
7269
=== Humanoid (Having an appearance or character resembling that of a human.) ===
7370
* team
@@ -87,7 +84,7 @@ function Humanoid(attributes) {
8784

8885
Humanoid.prototype = Object.create(CharacterStats.prototype);
8986
Humanoid.prototype.greet = function() {
90-
console.log(`${this.name} offers a greeting in ${this.language}.`);
87+
return `${this.name} offers a greeting in ${this.language}.`;
9188
}
9289

9390
const kent = new Humanoid({
@@ -103,8 +100,6 @@ const kent = new Humanoid({
103100
language: 'kryptonia'
104101

105102
})
106-
console.log(kent);
107-
console.log(kent.greet());
108103

109104
/*
110105
* Inheritance chain: GameObject -> CharacterStats -> Humanoid

0 commit comments

Comments
 (0)