|
| 1 | +'use strict'; |
| 2 | +//1.git |
| 3 | + |
| 4 | +const bookIds = [ |
| 5 | + 'oliver_twist', |
| 6 | + 'hamlet', |
| 7 | + 'antony_and_cleopatra', |
| 8 | + 'macbeth', |
| 9 | + 'waiting_for_godot', |
| 10 | + 'arms_and_the_man', |
| 11 | + 'the-merchant_of_venice', |
| 12 | + 'crime_and_punishment', |
| 13 | + 'romeo_and_juliet', |
| 14 | + 'a_tale_of_two_cities', |
| 15 | +]; |
| 16 | +//console.log(bookIds); |
| 17 | + |
| 18 | +//3. |
| 19 | +function books(bookIds) { |
| 20 | + const ul = document.createElement('ul'); |
| 21 | + document.items.appendChild(ul); |
| 22 | + for (let index = 0; index < bookIds.length; index++) { |
| 23 | + const li = document.createElement('li'); |
| 24 | + li.textContent = bookIds[index]; |
| 25 | + ul.appendChild(li); |
| 26 | + } |
| 27 | +} |
| 28 | + |
| 29 | +//4. |
| 30 | +const DifferentBooks = [ |
| 31 | + { |
| 32 | + title: 'Oliver Twist', |
| 33 | + language: 'English', |
| 34 | + author: 'Charles-Dickens', |
| 35 | + }, |
| 36 | + { |
| 37 | + title: 'Hamlet', |
| 38 | + language: 'English', |
| 39 | + author: 'Shakespeare', |
| 40 | + }, |
| 41 | + { |
| 42 | + title: 'Antony and Cleopatra', |
| 43 | + language: 'English', |
| 44 | + author: 'Shakespeare', |
| 45 | + }, |
| 46 | + { |
| 47 | + title: 'Macbeth', |
| 48 | + language: 'English', |
| 49 | + author: 'Shakespeare', |
| 50 | + }, |
| 51 | + { |
| 52 | + title: 'Waiting for Godot', |
| 53 | + language: 'English', |
| 54 | + author: 'Samuel Becket', |
| 55 | + }, |
| 56 | + { |
| 57 | + title: 'Arms and the Man', |
| 58 | + language: 'English', |
| 59 | + author: 'George Bernard Show', |
| 60 | + }, |
| 61 | + { |
| 62 | + title: 'The Merchant of Venice', |
| 63 | + language: 'English', |
| 64 | + author: 'Shakespeare', |
| 65 | + }, |
| 66 | + { |
| 67 | + title: 'Crime and Punishment', |
| 68 | + language: 'Russian', |
| 69 | + author: 'Fyodor Dostoevsky', |
| 70 | + }, |
| 71 | + { |
| 72 | + title: 'Romeo and Juliet', |
| 73 | + language: 'English', |
| 74 | + author: 'Shakespeare', |
| 75 | + }, |
| 76 | + { |
| 77 | + title: 'A Tale of Two Cities', |
| 78 | + language: 'English', |
| 79 | + author: 'Charles Dickens', |
| 80 | + }, |
| 81 | +]; |
| 82 | + |
| 83 | +//5. |
| 84 | +//Can NOT answer it. |
| 85 | + |
| 86 | +//7. |
| 87 | +const newBookIds = { |
| 88 | + oliver_twist: './img/oliver_twist.jpg', |
| 89 | + hamlet: './img/hamlet.jpg', |
| 90 | + antony_and_cleopatra: './img/antony_and_cleopatra.jpg', |
| 91 | + macbeth: './img/macbeth.jpg', |
| 92 | + waiting_for_godot: './img/waiting_for-godot.jpg', |
| 93 | + arms_and_the_man: './img/arms_and_the_man.jpg', |
| 94 | + the_merchant_of_venice: './img/the_merchant_of_venice.jpg', |
| 95 | + crime_and_punishment: './img/crime_and_punishment.jpg', |
| 96 | + romeo_and_juliet: './img/romeo_and_juliet.jpg', |
| 97 | + a_tale_of_two_cities: './img/a_tale_of_two_cities.jpg', |
| 98 | +}; |
| 99 | + |
| 100 | +//8. |
| 101 | +const entries = DifferentBooks.length; |
| 102 | +for (let index = 0; index < entries; index++) { |
| 103 | + console.log(entries.author); |
| 104 | +} |
0 commit comments