@@ -29,8 +29,6 @@ function exerciseOne(arrayOfPeople) {
2929 targetElement . appendChild ( newHeading ) ; // add h1 to div with id='content'
3030 targetElement . appendChild ( newSubHeading ) ; // add h2 to div with id='content'
3131 } ) ;
32-
33-
3432}
3533/**
3634 *
@@ -50,15 +48,12 @@ function exerciseTwo(shopping) {
5048 // console.log(shoppingItem); // what does shopping item access?
5149 // create a list item for each item in the 'shopping' array
5250 let listItem = document . createElement ( 'li' ) ;
53- listItem . innerText = shoppingItem
51+ listItem . innerText = shoppingItem ;
5452
5553 unorderedList . appendChild ( listItem ) ;
5654
5755 findElement . appendChild ( unorderedList ) ;
58- } )
59-
60-
61-
56+ } ) ;
6257}
6358
6459/**
@@ -92,6 +87,29 @@ function exerciseTwo(shopping) {
9287**/
9388function exerciseThree ( books ) {
9489 //Write your code in here
90+ const positionForParagraph = document . getElementById ( 'content' ) ;
91+ // console.log(positionForParagraph);
92+
93+ let unorderedListForBooks = document . createElement ( 'ul' ) ;
94+ positionForParagraph . appendChild ( unorderedListForBooks ) ;
95+
96+ books . forEach ( book => {
97+
98+ let titleAndAuthor = document . createElement ( 'p' ) ;
99+ // console.log(`${book.title} written by ${book.author}`);
100+ titleAndAuthor . innerText = `${ book . title } written by ${ book . author } ` ;
101+
102+ let listedItem = document . createElement ( 'li' ) ;
103+ // console.log(listedItem);
104+
105+ let imageItem = document . createElement ( 'img' ) ;
106+ console . log ( imageItem ) ;
107+ imageItem . style = background - color red
108+
109+ unorderedListForBooks . appendChild ( listedItem ) ;
110+ listedItem . appendChild ( titleAndAuthor ) ;
111+ listedItem . appendChild ( imageItem ) ;
112+ } ) ;
95113}
96114
97115//
0 commit comments