File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// Predict and explain first...
2- // To specify house number the console.log should use. address.houseNumber.
3- // without it, It would show as undefined
2+ /* To specify house number the console.log should use. address.houseNumber.
3+ without it, It would show as undefined */
44
55// This code should log out the houseNumber from the address object
66// but it isn't working...
Original file line number Diff line number Diff line change 33// This program attempts to log out all the property values in the object.
44// But it isn't working. Explain why first and then fix the problem
55
6+ /* The code wants to log the property value and is using a for...of loop
7+ to make sure it logs everything, however Objects aren't in order and Javascript
8+ doesn't know what you want. Author is an Object and objects are not
9+ iterable which is the error. To fix this change (const value of author) to
10+ (const value of object.values(author)) to specify we want the values (not properties)
11+ in the Object which is 'author'. Using a loop allows up to add information in author
12+ without needing to make changes anywhere else while getting an updated log */
13+
614const author = {
715 firstName : "Zadie" ,
816 lastName : "Smith" ,
@@ -11,6 +19,6 @@ const author = {
1119 alive : true ,
1220} ;
1321
14- for ( const value of author ) {
22+ for ( const value of Object . values ( author ) ) {
1523 console . log ( value ) ;
1624}
You can’t perform that action at this time.
0 commit comments