diff --git a/Week1/homework/app.js b/Week1/homework/app.js index ffef836dc..43ed32f05 100644 --- a/Week1/homework/app.js +++ b/Week1/homework/app.js @@ -1,11 +1,138 @@ 'use strict'; { const bookTitles = [ - // Replace with your own book titles - 'harry_potter_chamber_secrets' + 'a_game_of_thrones', + 'a_clash_of_kings', + 'a_storm_of_swords', + 'a_feast_of_crows', + 'a_dance_with_dragons', + 'harry_potter_chamber_secrets', + 'harry_potter_prisoner_azkaban', + 'harry_potter_goblet_fire', + 'harry_potter_order_phoenix', + 'harry_potter_deathly_hallows' ]; + const booksInfo = { + a_game_of_thrones: { + title: 'A Song of Ice and Fire - A Game of Thrones', + language: 'English', + author: 'George R.R. Martin', + pages: '694', + }, - // Replace with your own code - console.log(bookTitles); + a_clash_of_kings: { + title: 'A Song of Ice and Fire - A Clash of Kings', + language: 'English', + author: 'George R.R. Martin', + pages: '768', + }, + a_storm_of_swords: { + title: 'A Song of Ice and Fire - A Storm of Swords', + language: 'English', + author: 'George R.R. Martin', + pages: '973', + }, + a_feast_of_crows: { + title: 'A Song of Ice and Fire - A Feast of crows', + language: 'English', + author: 'George R.R. Martin', + pages: '753', + }, + a_dance_with_dragons: { + title: 'A Song of Ice and Fire - A Dance with Dragons', + language: 'English', + author: 'George R.R. Martin', + pages: '1040', + }, + harry_potter_chamber_secrets: { + title: 'Harry Potter and the Chamber of Secrets', + language: 'English', + author: 'J. K. Rowling', + pages: '251', + }, + harry_potter_prisoner_azkaban: { + title: 'Harry Potter and the Prisoner of Azkaban', + language: 'English', + author: 'J. K. Rowling', + pages: '317', + }, + harry_potter_goblet_fire: { + title: 'Harry Potter and the Goblet of Fire', + language: 'English', + author: 'J. K. Rowling', + pages: '636', + }, + harry_potter_order_phoenix: { + title: 'Harry Potter and the Order of the Phoenix', + language: 'English', + author: 'J. K. Rowling', + pages: '766', + }, + harry_potter_deathly_hallows: { + title: 'Harry Potter and the Deathly Hallows', + language: 'English', + author: 'J. K. Rowling', + pages: '694', + } + }; + + function main() { + const container = document.getElementById('myBooks'); + const Header = document.createElement('h1'); + Header.innerHTML = 'My Top 10 Books'; + container.appendChild(Header); + + const booksList = document.createElement('ul'); + container.appendChild(booksList); + + for (const i in booksInfo) { + const li = document.createElement('li'); + booksList.appendChild(li); + li.setAttribute("id", [i]); + + const title = document.createElement('h2'); + li.appendChild(title); + title.innerHTML = booksInfo[i].title; + + const language = document.createElement('p'); + li.appendChild(language); + language.innerHTML = 'Language: ' + booksInfo[i].language; + + const author = document.createElement('p'); + li.appendChild(author); + author.innerHTML = 'Author: ' + booksInfo[i].author; + + const pages = document.createElement('p'); + li.appendChild(pages); + pages.innerHTML = 'Pages: ' + booksInfo[i].pages; + } + + + const images = { + a_game_of_thrones: './img/a_game_of_Thrones.jpg', + a_clash_of_kings: './img/a_clash_of_kings.jpg', + a_storm_of_swords: './img/a_storm_of_swords.jpg', + a_feast_of_crows: './img/a_feast_of_crows.jpg', + a_dance_with_dragons: './img/a_dance_with_dragons.jpg', + harry_potter_chamber_secrets: './img/harry_potter_chamber_secrets.jpeg', + harry_potter_prisoner_azkaban: './img/harry_potter_prisoner_azkaban.jpg', + harry_potter_goblet_fire: './img/harry_potter_goblet_fire.jpg', + harry_potter_order_phoenix: './img/harry_potter_order_phoenix.jpeg', + harry_potter_deathly_hallows: './img/harry_potter_deathly_hallows.jpg' + }; + + for (const key in images) { + const img = document.createElement('img'); + img.setAttribute('src', images[key]); + img.setAttribute('alt', key); + + const imgList = document.createElement('li'); + imgList.appendChild(img); + + const x = document.getElementById(key); + x.appendChild(imgList); + } + } + window.addEventListener('load', main); } diff --git a/Week1/homework/img/a_clash_of_kings.jpg b/Week1/homework/img/a_clash_of_kings.jpg new file mode 100644 index 000000000..03b3a1608 Binary files /dev/null and b/Week1/homework/img/a_clash_of_kings.jpg differ diff --git a/Week1/homework/img/a_dance_with_dragons.jpg b/Week1/homework/img/a_dance_with_dragons.jpg new file mode 100644 index 000000000..83638d692 Binary files /dev/null and b/Week1/homework/img/a_dance_with_dragons.jpg differ diff --git a/Week1/homework/img/a_feast_of_crows.jpg b/Week1/homework/img/a_feast_of_crows.jpg new file mode 100644 index 000000000..553885a1f Binary files /dev/null and b/Week1/homework/img/a_feast_of_crows.jpg differ diff --git a/Week1/homework/img/a_game_of_thrones.jpg b/Week1/homework/img/a_game_of_thrones.jpg new file mode 100644 index 000000000..6cff3c537 Binary files /dev/null and b/Week1/homework/img/a_game_of_thrones.jpg differ diff --git a/Week1/homework/img/a_storm_of_swords.jpg b/Week1/homework/img/a_storm_of_swords.jpg new file mode 100644 index 000000000..9ab2cbd2d Binary files /dev/null and b/Week1/homework/img/a_storm_of_swords.jpg differ diff --git a/Week1/homework/img/harry_potter_chamber_secrets.jpeg b/Week1/homework/img/harry_potter_chamber_secrets.jpeg new file mode 100644 index 000000000..1e578ccdc Binary files /dev/null and b/Week1/homework/img/harry_potter_chamber_secrets.jpeg differ diff --git a/Week1/homework/img/harry_potter_deathly_hallows.jpg b/Week1/homework/img/harry_potter_deathly_hallows.jpg new file mode 100644 index 000000000..0156f7e22 Binary files /dev/null and b/Week1/homework/img/harry_potter_deathly_hallows.jpg differ diff --git a/Week1/homework/img/harry_potter_goblet_fire.jpg b/Week1/homework/img/harry_potter_goblet_fire.jpg new file mode 100644 index 000000000..205ec01ce Binary files /dev/null and b/Week1/homework/img/harry_potter_goblet_fire.jpg differ diff --git a/Week1/homework/img/harry_potter_order_phoenix.jpeg b/Week1/homework/img/harry_potter_order_phoenix.jpeg new file mode 100644 index 000000000..9f232c5a6 Binary files /dev/null and b/Week1/homework/img/harry_potter_order_phoenix.jpeg differ diff --git a/Week1/homework/img/harry_potter_prisoner_azkaban.jpg b/Week1/homework/img/harry_potter_prisoner_azkaban.jpg new file mode 100644 index 000000000..723e60862 Binary files /dev/null and b/Week1/homework/img/harry_potter_prisoner_azkaban.jpg differ diff --git a/Week1/homework/index.html b/Week1/homework/index.html index b22147cd1..abc330bfc 100644 --- a/Week1/homework/index.html +++ b/Week1/homework/index.html @@ -1 +1,15 @@ - \ No newline at end of file + + + + + + + + + + +
+ + + + \ No newline at end of file diff --git a/Week1/homework/style.css b/Week1/homework/style.css index bab13ec23..375fcbbc2 100644 --- a/Week1/homework/style.css +++ b/Week1/homework/style.css @@ -1 +1,16 @@ -/* add your styling here */ \ No newline at end of file +*{ + list-style-type: none; +} + +img{ + width: 200px; + border: 2px solid black +} + +h1, h2, p{ + font-family: "tahoma"; +} + +#myBooks { + text-align: center; +} \ No newline at end of file diff --git a/Week2/homework/maartjes_work.js b/Week2/homework/maartjes_work.js index 0b451d122..0ef043731 100644 --- a/Week2/homework/maartjes_work.js +++ b/Week2/homework/maartjes_work.js @@ -45,3 +45,10 @@ const tuesday = [ const tasks = monday.concat(tuesday); // Add your code here +const salary = tasks + .map((task) => (task.duration / 60)) + .filter((duration) => duration >= 2) + .map((duration) => duration * 23) + .reduce((acc, current) => acc + current); + +console.log('Maartje has earned €' + salary.toFixed(2)); diff --git a/Week2/homework/map_filter.js b/Week2/homework/map_filter.js index b6af22631..77f02ea97 100644 --- a/Week2/homework/map_filter.js +++ b/Week2/homework/map_filter.js @@ -3,3 +3,8 @@ const numbers = [1, 2, 3, 4]; // Add your code here +const newNumbers = numbers + .filter(newNumber => newNumber % 2 !== 0) + .map(newNumber => newNumber * 2); + +console.log(newNumbers);