@@ -24,7 +24,7 @@ function GameObject(attributes) {
2424}
2525
2626GameObject . prototype . destroy = function ( ) {
27- console . log ( `${ this . name } was removed from the game.` ) ;
27+ return `${ this . name } was removed from the game.` ;
2828}
2929
3030let 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) {
5351CharacterStats . prototype = Object . create ( GameObject . prototype ) ;
5452
5553CharacterStats . prototype . takeDamage = function ( ) {
56- console . log ( `${ this . name } took damage.` ) ;
54+ return `${ this . name } took damage.` ;
5755}
5856
5957let 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
8885Humanoid . prototype = Object . create ( CharacterStats . prototype ) ;
8986Humanoid . 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
9390const 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