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-
2+ // i think its because the address is not used as an array but as an object
33// This code should log out the houseNumber from the address object
44// but it isn't working...
55// Fix anything that isn't working
@@ -12,4 +12,4 @@ const address = {
1212 postcode : "XYZ 123" ,
1313} ;
1414
15- console . log ( `My house number is ${ address [ 0 ] } ` ) ;
15+ console . log ( `My house number is ${ address . houseNumber } ` ) ;
Original file line number Diff line number Diff line change 11// Predict and explain first...
2-
2+ //i think its because value is not used as a parameter of an object, and author is an object not an ordered list Array.
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
5-
5+ // i found that object literals are not iterative because they have no orders
66const author = {
77 firstName : "Zadie" ,
88 lastName : "Smith" ,
@@ -11,6 +11,6 @@ const author = {
1111 alive : true ,
1212} ;
1313
14- for ( const value of author ) {
14+ for ( const value of Object . values ( author ) ) {
1515 console . log ( value ) ;
1616}
Original file line number Diff line number Diff line change 11// Predict and explain first...
2-
2+ /*
3+ console.log(`${recipe.title} serves ${recipe.serves}
4+ ingredients:
5+ ${recipe}`);// here it misses recipe.ingredients
6+ */
37// This program should log out the title, how many it serves and the ingredients.
48// Each ingredient should be logged on a new line
59// How can you fix it?
@@ -12,4 +16,4 @@ const recipe = {
1216
1317console . log ( `${ recipe . title } serves ${ recipe . serves }
1418 ingredients:
15- ${ recipe } `) ;
19+ ${ recipe . ingredients . join ( "\n" ) } `) ; // this make the list to be logged on a new line - not predicted at first
You can’t perform that action at this time.
0 commit comments