diff --git a/Week1/homework/app.js b/Week1/homework/app.js index a9b5f75d8..b9836e281 100644 --- a/Week1/homework/app.js +++ b/Week1/homework/app.js @@ -1,11 +1,87 @@ -'use strict'; +const bookTitles = [ + "Harry Potter and the Philosopher's stone", + "Harry Potter and the Chamber of secrets", + "Harry Potter and the Prisoner of Azkaban", + "Harry Potter and the Globlet of fire", + "Harry Potter and the Order of the Phoenix", + "Harry Potter and the Half blood prince", + "Harry Potter and the Deathly hallows" +]; -{ - const bookTitles = [ - // Replace with your own book titles - 'harry_potter_chamber_secrets', - ]; - // Replace with your own code - console.log(bookTitles); +const bookData = { + book_1: { + title: "Harry Potter and the Philosopher's stone", + language: "English", + author: "J. K. Rowling" + }, + book_2: { + title: "Harry Potter and the Chamber of secrets", + language: "English", + author: "J. K. Rowling" + }, + book_3: { + title: "Harry Potter and the Prisoner of Azkaban", + language: "English", + author: "J. K. Rowling" + }, + book_4: { + title: "Harry Potter and the Globlet of fire", + language: "English", + author: "J. K. Rowling" + }, + book_5: { + title: "Harry Potter and the Order of the Phoenix", + language: "English", + author: "J. K. Rowling" + }, + book_6: { + title: " Harry Potter and the Half blood prince", + language: "English", + author: "J. K. Rowling" + }, + + book_7 : { + title:"Harry Potter and the Deathly hallows", + language: "English", + author: "J. K. Rowling" + } +}; + +const cover = { + book_1: "asset/1.jpg", + book_2: "asset/2.jpg", + book_3: "asset/3.jpg", + book_4: "asset/4.jpg", + book_5: "asset/5.jpg", + book_6: "asset/6.jpg", + book_7: "asset/7.jpg" } + + +function generateBookList() { + const bookList = document.createElement('ul'); + for (const bookId of Object.keys(bookData)) { + const bookInfo = bookData[bookId]; + const bookItem = document.createElement('li'); + bookItem.id = bookId; + const bookTitle = document.createElement('h2'); + bookTitle.textContent = bookInfo.title; + bookItem.appendChild(bookTitle); + const bookAuthor = document.createElement('p'); + bookAuthor.textContent = 'Author: ' + bookInfo.author; + bookItem.appendChild(bookAuthor); + const bookLanguage = document.createElement('p'); + bookLanguage.textContent = 'Language: ' + bookInfo.language; + bookItem.appendChild(bookLanguage); + const bookCover = document.createElement('img'); + bookCover.src = cover[bookId]; + bookCover.alt = bookInfo.title + ' book cover'; + bookItem.appendChild(bookCover); + bookList.appendChild(bookItem); + } + document.body.appendChild(bookList); + return bookList; +} + +generateBookList(); \ No newline at end of file diff --git a/Week1/homework/asset/1.jpg b/Week1/homework/asset/1.jpg new file mode 100644 index 000000000..856ef78f2 Binary files /dev/null and b/Week1/homework/asset/1.jpg differ diff --git a/Week1/homework/asset/2.jpg b/Week1/homework/asset/2.jpg new file mode 100644 index 000000000..061f6d800 Binary files /dev/null and b/Week1/homework/asset/2.jpg differ diff --git a/Week1/homework/asset/3.jpg b/Week1/homework/asset/3.jpg new file mode 100644 index 000000000..3572d7b9c Binary files /dev/null and b/Week1/homework/asset/3.jpg differ diff --git a/Week1/homework/asset/4.jpg b/Week1/homework/asset/4.jpg new file mode 100644 index 000000000..5f6db5a89 Binary files /dev/null and b/Week1/homework/asset/4.jpg differ diff --git a/Week1/homework/asset/5.jpg b/Week1/homework/asset/5.jpg new file mode 100644 index 000000000..e0fb2713b Binary files /dev/null and b/Week1/homework/asset/5.jpg differ diff --git a/Week1/homework/asset/6.jpg b/Week1/homework/asset/6.jpg new file mode 100644 index 000000000..1c3dadce1 Binary files /dev/null and b/Week1/homework/asset/6.jpg differ diff --git a/Week1/homework/asset/7.jpg b/Week1/homework/asset/7.jpg new file mode 100644 index 000000000..4c437d6d7 Binary files /dev/null and b/Week1/homework/asset/7.jpg differ diff --git a/Week1/homework/index.html b/Week1/homework/index.html index b22147cd1..e84e35b20 100644 --- a/Week1/homework/index.html +++ b/Week1/homework/index.html @@ -1 +1,17 @@ - \ No newline at end of file + + +
+ + + + + + + +