File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,7 +115,4 @@ inventory.forEach(function(element){
115115 }
116116 index ++ ;
117117} ) ;
118- console . log ( JSON . stringify ( BMWAndAudi ) ) ;
119-
120-
121-
118+ console . log ( JSON . stringify ( BMWAndAudi ) ) ;
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ const kennan = {
3030 "email" : "kdiben1@tinypic.com" ,
3131 "gender" : "M" ,
3232 speak ( ) {
33- return `" Hello, my name is ${ kennan . name } !" ` ;
33+ return `Hello, my name is ${ kennan . name } !` ;
3434 } ,
3535} ;
3636const keven = {
@@ -85,16 +85,37 @@ console.log(antonietta.multiplyNums(3,4));
8585// 3. Nest a grandchild object in the child object with properties for name and age. The name will be Sam and the age will be 30
8686// 4. Give each of the objects the ability to speak their names using the this keyword.
8787
88- const parent = { }
88+ const parent = {
89+ name : "Susan" ,
90+ age : 70 ,
91+ speak ( ) {
92+ console . log ( `Hello, my name is ${ this . name } ` ) ;
93+ } ,
94+ child : {
95+ name : "George" ,
96+ age : 50 ,
97+ speak ( ) {
98+ console . log ( `Hello, my name is ${ this . name } ` ) ;
99+ } ,
100+ grandchild : {
101+ name : "Sam" ,
102+ age : 30 ,
103+ speak ( ) {
104+ console . log ( `Hello, my name is ${ this . name } ` ) ;
105+ } ,
106+ }
107+ }
108+ } ;
89109
90110// Log the parent object's name
91-
111+ console . log ( parent . name ) ;
92112// Log the child's age
93-
113+ console . log ( parent . child . age ) ;
94114// Log the name and age of the grandchild
95-
115+ console . log ( ` ${ parent . child . grandchild . name } ${ parent . child . grandchild . age } ` ) ;
96116// Have the parent speak
97-
117+ parent . speak ( ) ;
98118// Have the child speak
99-
119+ parent . child . speak ( ) ;
100120// Have the grandchild speak
121+ parent . child . grandchild . speak ( ) ;
You can’t perform that action at this time.
0 commit comments