|
4 | 4 | const bookTitles = [
|
5 | 5 | // Replace with your own book titles
|
6 | 6 | 'harry_potter_chamber_secrets',
|
| 7 | + 'awaken_the_giant_within_me', |
| 8 | + 'if_tomorrow_comes', |
| 9 | + 'unlimited_power', |
| 10 | + 'the_power_of_positive_thinking', |
| 11 | + 'the_power_of_character_in_leadership', |
| 12 | + 'the_girl_on_the_train', |
| 13 | + 'man_and_the_sea', |
| 14 | + 'fiker_eske_mekabir', |
| 15 | + 'keadmas_basher', |
| 16 | + 'yetekolefebet', |
7 | 17 | ];
|
| 18 | + function bookListCreater(bookListobj) { |
| 19 | + const ul = document.createElement('ul'); |
| 20 | + document.getElementById('bookListDiv').appendChild(ul); |
8 | 21 |
|
9 |
| - // Replace with your own code |
10 |
| - console.log(bookTitles); |
| 22 | + for (let propobj in bookListobj) { |
| 23 | + let li = document.createElement('li'); |
| 24 | + ul.appendChild(li); |
| 25 | + li.innerHTML = propobj; |
| 26 | + //li.innerHTML = bookListobj[propobj]; |
| 27 | + console.log(bookListobj[propobj]); |
| 28 | + } |
| 29 | + } |
| 30 | + |
| 31 | + // Creating object |
| 32 | + let allBookInformation = { |
| 33 | + harry_potter_chamber_secrets: { |
| 34 | + bookInfo: { |
| 35 | + title: bookTitles[0].toUpperCase(), |
| 36 | + language: 'Eneglish', |
| 37 | + author: 'J. K. Rowling', |
| 38 | + }, |
| 39 | + }, |
| 40 | + awaken_the_giant_within_me: { |
| 41 | + bookInfo: { |
| 42 | + title: bookTitles[1].toUpperCase(), |
| 43 | + language: 'Eneglish', |
| 44 | + author: 'Tony Robbins', |
| 45 | + }, |
| 46 | + }, |
| 47 | + |
| 48 | + if_tomorrow_comes: { |
| 49 | + bookInfo: { |
| 50 | + title: bookTitles[2].toUpperCase(), |
| 51 | + language: 'Eneglish', |
| 52 | + author: 'Sidney Sheldon', |
| 53 | + }, |
| 54 | + }, |
| 55 | + |
| 56 | + if_tomorrow_comes: { |
| 57 | + bookInfo: { |
| 58 | + title: bookTitles[3].toUpperCase(), |
| 59 | + language: 'Eneglish', |
| 60 | + author: 'Tony Robbins', |
| 61 | + }, |
| 62 | + }, |
| 63 | + |
| 64 | + unlimited_power: { |
| 65 | + bookInfo: { |
| 66 | + title: bookTitles[4].toUpperCase(), |
| 67 | + language: 'Eneglish', |
| 68 | + author: 'Dr. Norman Vincent Peale', |
| 69 | + }, |
| 70 | + }, |
| 71 | + |
| 72 | + the_power_of_positive_thinking: { |
| 73 | + bookInfo: { |
| 74 | + title: bookTitles[5].toUpperCase(), |
| 75 | + language: 'Eneglish', |
| 76 | + author: 'Dr. Myles Munroe', |
| 77 | + }, |
| 78 | + }, |
| 79 | + |
| 80 | + the_girl_on_the_train: { |
| 81 | + bookInfo: { |
| 82 | + title: bookTitles[6].toUpperCase(), |
| 83 | + language: 'Eneglish', |
| 84 | + author: 'Paula Hawkins', |
| 85 | + }, |
| 86 | + }, |
| 87 | + |
| 88 | + man_and_the_sea: { |
| 89 | + bookInfo: { |
| 90 | + title: bookTitles[7].toUpperCase(), |
| 91 | + language: 'Eneglish', |
| 92 | + author: 'Ernest Hemingway', |
| 93 | + }, |
| 94 | + }, |
| 95 | + |
| 96 | + fiker_eske_mekabir: { |
| 97 | + bookInfo: { |
| 98 | + title: bookTitles[8].toUpperCase(), |
| 99 | + language: 'Amharic', |
| 100 | + author: 'Dr. Haddis Alemayehu', |
| 101 | + }, |
| 102 | + }, |
| 103 | + |
| 104 | + keadmas_basher: { |
| 105 | + bookInfo: { |
| 106 | + title: bookTitles[9].toUpperCase(), |
| 107 | + language: 'Amharic', |
| 108 | + author: 'Be alu Girma', |
| 109 | + }, |
| 110 | + }, |
| 111 | + |
| 112 | + yetekolefebet: { |
| 113 | + bookInfo: { |
| 114 | + title: bookTitles[10].toUpperCase(), |
| 115 | + language: 'Amharic', |
| 116 | + author: 'Dr Mihret Debebe ', |
| 117 | + }, |
| 118 | + }, |
| 119 | + }; |
| 120 | + console.log(allBookInformation); |
| 121 | + bookListCreater(allBookInformation); |
11 | 122 | }
|
0 commit comments