Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Week1/homework/1984.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/homework/The_Crimson_Rivers.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/homework/a tale of two cities.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/homework/a_clash_of_kings.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 0 additions & 11 deletions Week1/homework/app.js

This file was deleted.

13 changes: 13 additions & 0 deletions Week1/homework/app1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const books =[
"the_crimson_iver",
"hobbit",
"1984",
"the_return_of_the_king",
"the_ruins_of_gorlan ",
"a_clash_of_kings",
"the_forty_rules_of_love",
"my_name_is_red",
"the_new_york_triology",
"the_tale_of_two_cities"
];
console.log(books)
58 changes: 58 additions & 0 deletions Week1/homework/app4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const bookInfo ={
the_crimson_river : {
title : "The crimson River",
author: "Jean-Christophe Grangé",
language : "Frech"

},
hobbit:{
title : "Hobbit",
author : "J.J.Tolkein",
language : "English"

},
1984:{
title : "1984",
author : "George Orwel",
language : "English"

},

the_return_of_the_king:{
title : "The Return of the King",
author : "J.J.Tolkein",
language : "English"
},

the_ruins_of_gorlan:{
title : "The Ruins of Gorlan",
author : "John Flanagan",
language : "English"
},
a_clash_of_kings:{
title : "A Clash of Kings",
author : "J. R. Martin",
language : "English"
},
the_forty_rules_of_love:{
title : "The Forthy Rules of Love",
author : "Elif Safak",
language : "Turkish"
},
my_name_is_red:{
title : "my Name is Red",
author : "Orhan Pamuk",
language : "Turkish"
},
the_new_york_triology:{
title : "THe New York Triology",
author :"Paul Auster",
language : "English"
},
the_tale_of_two_cities:{
title : "The Tale of Two Cities",
author : "Charles Dickens",
language : "English"
}
}
console.log(bookInfo.my_name_is_red.title);
155 changes: 155 additions & 0 deletions Week1/homework/app5-7.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
'use strict'
const books =[
"the_crimson_iver",
"hobbit",
"1984",
"the_return_of_the_king",
"the_ruins_of_gorlan ",
"a_clash_of_kings",
"the_forty_rules_of_love",
"my_name_is_red",
"the_new_york_triology",
"the_tale_of_two_cities"

];
const bookInfo ={
the_crimson_river : {
title : "The crimson River",
author: "Jean-Christophe Grangé",
language : "Frech"

},
hobbit:{
title : "Hobbit",
author : "J.J.Tolkein",
language : "English"

},
1984:{
title : "1984",
author : "George Orwel",
language : "English"

},

the_return_of_the_king:{
title : "The Return of the King",
author : "J.J.Tolkein",
language : "English"
},

the_ruins_of_gorlan:{
title : "The Ruins of Gorlan",
author : "John Flanagan",
language : "English"
},
a_clash_of_kings:{
title : "A Clash of Kings",
author : "J. R. Martin",
language : "English"
},
the_forty_rules_of_love:{
title : "The Forthy Rules of Love",
author : "Elif Safak",
language : "Turkish"
},
my_name_is_red:{
title : "my Name is Red",
author : "Orhan Pamuk",
language : "Turkish"
},
the_new_york_triology:{
title : "The New York Triology",
author :"Paul Auster",
language : "English"
},
the_tale_of_two_cities:{
title : "The Tale of Two Cities",
author : "Charles Dickens",
language : "English"
}
}

function bookDetails(){
const ul = document.createElement("ul");

for (let i in books){

let bookLabel = books[i];
let li = document.createElement("li")
li.innerHTML=bookLabel;


let bookHead = document.createElement("h2");
bookHead.innerHTML=bookLabel.title;


let bookAuthor = document.createElement("p");
bookAuthor.innerHTML = bookLabel.author


let bookLanguage = document.createElement("p")
bookLanguage.innerHTML=bookLabel.language;

li.appendChild(ul);
bookHead.appendChild(li);
bookAuthor.appendChild(li);
bookLanguage.appendChild(li);


}
document.getElementById("show").appendChild(ul);
}
window.addEventListener("load",bookDetails)







//const ul = document.createElement("ul")
/*function bookList(){
for (let i=0; i<bookInfo.title.length; ++i){
let li = document.createElement("li");
let bookTitel = document.createElement("h2");
let bookAuthor = document.createElement("h3");
let bookLanguage = document.createElement("h4");
li.innerHTML=bookInfo.title[i];
ul.appendChild(li)
}

document.getElementById("show").appendChild(ul);
}
//window.addEventListener('load',bookList)*/
/*function bookLabel(){




const ul = document.createElement('ul')
for ( var k in bookInfo){
let book = bookInfo[k];
let li = document.createElement("li");

let bookTitel = document.createElement("h2");
bookTitel.innerHTML=book.title;



let bookAuthor = document.createElement("p");
bookAuthor.innerHTML=book.author;

let bookLanguage = document.createElement("p")
bookLanguage.innerHTML=book.language;

li.appendChild(bookTitel);
li.appendChild(bookAuthor);
li.appendChild(bookLanguage);
ul.appendChild(li);
}
return ul;
document.getElementById("show").appendChild(ul);
}

window.addEventListener('load',bookLabel)*/
26 changes: 26 additions & 0 deletions Week1/homework/apps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@


const books =[
"the_crimson_iver",
"hobbit",
"1984",
"the_return_of_the_king",
"the_ruins_of_gorlan ",
"a_clash_of_kings",
"the_forty_rules_of_love",
"my_name_is_red",
"the_new_york_triology",
"the_tale_of_two_cities"

];
window.onload=function booksList(){

let makeList = "<ul>";
for (let i = 0; i<books.length; i++){
makeList += "<li>" + books[i] + "</li>";
}
makeList += "</ul>"
document.getElementById("show").innerHTML=makeList;
//document.getElementById("show").appendChild(makeList)
}

Binary file added Week1/homework/hobbit.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/homework/my_name_is_red.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/homework/the return of the king.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/homework/the_forty_rules_of_love.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/homework/the_new_york_triology.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/homework/the_ruins_of_gorlan.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions Week2/homework/maartjes_work.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,13 @@ const tuesday = [
const tasks = monday.concat(tuesday);

// Add your code here
let twoHoursTasks = tasks.filter(x => x.duration >=120);
//console.log(twoHoursTasks);

let totalWorkingTime = twoHoursTasks.map(x => x.duration);
//console.log(totalWorkingTime);

const salaryPerHour = 25.5;

let totalSalary = totalWorkingTime.reduce((acc,val) => (acc + val)/60 * salaryPerHour,0)
console.log( "The salary of Maartje is "+"€ " +totalSalary.toFixed(2))
5 changes: 4 additions & 1 deletion Week2/homework/map_filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@

const numbers = [1, 2, 3, 4];

// Add your code here
let oddNumbers = numbers.filter(x => x % 2 !==0);
console.log(oddNumbers);
let doubleNumbers = oddNumbers.map(x => x*2);
console.log('The doubled numbers are :', doubleNumbers)
2 changes: 1 addition & 1 deletion Week3/homework/1-step3.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

function foo(func) {
// What to do here?
return bar();
}

function bar() {
Expand Down
26 changes: 24 additions & 2 deletions Week3/homework/2-step3.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,29 @@

function threeFive(startIndex, stopIndex, threeCallback, fiveCallback) {
const values = [];
// Add your code here

for (let i =startIndex; i <=stopIndex; i++){
values.push(i)
}
//console.log(values)

for(let i = 0; i<values.length; i++){
if (values [i] % 5 ===0 && values[i] % 3 === 0){
sayThree(values [i])
sayFive(values [i])

}else if (values[i] % 3 === 0){ sayThree(values[i])

}else if(values [i] % 5 ===0){ sayFive(values [i])

}

}

}
let sayThree= (x) => console.log(x + " can be divided by three")

let sayFive= (x) => console.log( x + " can be divided by five")


threeFive(10, 15, sayThree, sayFive);
threeFive(10, 15);
37 changes: 32 additions & 5 deletions Week3/homework/3-step3.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,51 @@

// use a 'for' loop
function repeatStringNumTimesWithFor(str, num) {
// add your code here
return str;
// repeat after me
let x = "";
for (let i=num; i>0; --i){
x += str
}
return x;
}

console.log('for', repeatStringNumTimesWithFor('abc', 3));

// use a 'while' loop
function repeatStringNumTimesWithWhile(str, num) {
// add your code here
return str;
let x = ""
while(num>0){
num--
x += str;
}
return x;
}

console.log('while', repeatStringNumTimesWithWhile('abc', 3));

// use a 'do...while' loop
function repeatStringNumTimesWithDoWhile(str, num) {
// add your code here
return str;
let x =""
do {
x += str;
num--
} while(num>0)
return x;
}

console.log('while', repeatStringNumTimesWithDoWhile('abc', 3));


//bonus
let solutionWithFunction = (str,num) => {
if (num < 0)
return str =""
if (num == 1)
return str
else {
return str + solutionWithFunction(str,num-1)

}
}
console.log('bonus', solutionWithFunction('abc', 3));
Loading