diff --git a/Week1/homework/app.js b/Week1/homework/app.js index a9b5f75d8..0cad1f9ce 100644 --- a/Week1/homework/app.js +++ b/Week1/homework/app.js @@ -1,11 +1,65 @@ -'use strict'; -{ - const bookTitles = [ - // Replace with your own book titles - 'harry_potter_chamber_secrets', - ]; +'use strict' +const books = [ + { + title :"Harry Potter Chamber of Secrets", + language:"english", + author:"Joanne K. Rowling", - // Replace with your own code - console.log(bookTitles); + }, + + { + title:"Alchemist", + language:"english", + author:"paulo-co", + + }, + + { + title:"Paula", + language:"english", + author:"isabel allende", + + }, + + { + + title:"Orlando", + language:"english", + author:"virginia-wolf", + + }, + + { + title:"Divine Comedy", + language:"English", + author:"dante", + + }, + + { + title:"The Odyssey", + language: "english", + author:"Homeros", + + }, + +] + +function createAndAppend(parent,typ,attributes={}) { + + const elem = document.createElement(typ) + + parent.appendChild(elem) + + for (const key in attributes) + + elem[key] = attributes[key] + return elem } + +const ul = createAndAppend(document.body, 'ul', {}) +for (const index in books) { + const book = books[index] + createAndAppend(ul, 'li', {value : index, innerHTML: book.title}) +} \ No newline at end of file diff --git a/Week1/homework/index.html b/Week1/homework/index.html index b22147cd1..93ea94ef0 100644 --- a/Week1/homework/index.html +++ b/Week1/homework/index.html @@ -1 +1,10 @@ - \ No newline at end of file + + +
+