diff --git a/Sprint-2/debug/address.js b/Sprint-2/debug/address.js index 940a6af83..e19ab9314 100644 --- a/Sprint-2/debug/address.js +++ b/Sprint-2/debug/address.js @@ -12,4 +12,4 @@ const address = { postcode: "XYZ 123", }; -console.log(`My house number is ${address[0]}`); +console.log(`My house number is ${address[0]}`); \ No newline at end of file diff --git a/Sprint-2/debug/recipe.js b/Sprint-2/debug/recipe.js index 6cbdd22cd..1f2146266 100644 --- a/Sprint-2/debug/recipe.js +++ b/Sprint-2/debug/recipe.js @@ -12,4 +12,4 @@ const recipe = { console.log(`${recipe.title} serves ${recipe.serves} ingredients: -${recipe}`); +${recipe}`); \ No newline at end of file diff --git a/Sprint-3/reading-list/script.js b/Sprint-3/reading-list/script.js index 6024d73a0..86227f7b2 100644 --- a/Sprint-3/reading-list/script.js +++ b/Sprint-3/reading-list/script.js @@ -21,3 +21,27 @@ const books = [ }, ]; +function readingList(books) { + const list = document.getElementById("reading-list"); + + books.forEach((book) => { + const li = document.createElement("li"); + li.style.backgroundColor = book.alreadyRead ? "green" : "red"; + + const title = document.createElement("p"); + title.textContent = book.title; + + const author = document.createElement("p"); + author.textContent = book.author; + + const image = document.createElement("img"); + image.src = book.bookCoverImage; + + li.appendChild(title); + li.appendChild(author); + li.appendChild(image); + list.appendChild(li); + }); +} + +readingList(books);