Skip to content
Open
Show file tree
Hide file tree
Changes from 8 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
125 changes: 118 additions & 7 deletions Week1/homework/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,122 @@
'use strict';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an extra space here. In fact, I think there looks like to be lots of strange spacing. Can you run prettier on your files so they fix the formatting issues?

'use strict';
{
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This opening bracket will cause problems...

const bookTitles = [
// Replace with your own book titles
'harry_potter_chamber_secrets',
];

// Replace with your own code
console.log(bookTitles);
const title = [

'harry_potter_chamber_secrets',

'alchemist', //Paulo coelho
'paula',
'orlando',
'divine-comedy',
'the-odyssey',
];

let objBooks = {

"harry_potter_chamber_secrets" :
{

title :"harry_potter_chamber_secrets",

language:"english",

author:"Joanne K. Rowling",

},

"alchemist":
{
title:"alchemist",

language:"english",

author:"paulo-coelho",

},

"paula":{

title:"paula",

language:"english",

author:"isabel allende",

},
"orlando":
{
title:"orlando",

language:"english",

author:"virgina wolf",

},
"divine-comedy" :
{

title:"divine-comedy",

language:"English",

author:"dante",

},

"the-odyssey":
{

title:"the-odyssey",

language: "english",

author:"homeros",

}



}



function listBooks() {

let i = 0;

let ul = document.createElement('ul')

for (i = 0; i < title.length; i++) {

let li = document.createElement('li');

li.textContent = title[i];

ul.appendChild(li);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this actually adding elements to the screen. Do you see anything on yours? You have to then add the ul to the DOM.

}

document.body.appendChild(ul);
document.body.onload = listBooks;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, Think you'll have to do Prettier for everything. See how the indentation is off here?

const objBooksArr = [];
for (const newListBooks in objBooks) {
console.log(newListBooks);
objBooksArr.push(objBooks[newListBooks])

}



const bookPic = {

'harry_potter_chamber_secrets':potter.jpg ,
'alchemist':alchemist,
'paula' :paula.jpg,
'orlando':woolf.jpg,
'divine-comedy':divine.jpg,
'the-odyssey' :odyssy.jpg,
};


19 changes: 18 additions & 1 deletion Week1/homework/index.html
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
<!-- replace this with your HTML content -->
<!-- replace this with your HTML content -->
<!DOCTYPE html>

<html>

<head>

<title> Book Titles</title>
<script src="app.js"></script>

</head>
<body>

<div id="objBooksArr"></div>


</body>
</html>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange spacing here too

Binary file added Week1/homework/odyssy.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/paula.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/potter.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/woolf.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion Week2/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
</head>
<body>
<h3>Here is your advice for the day:</h3>
<h1 id="advice"></h1>
<ul id="advice"></ul>
<button id="add-advice">add one more </button>
<script type="text/javascript" src="./lecture-exercises.js"></script>
</body>
</html>
27 changes: 26 additions & 1 deletion Week2/homework/map-filter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict';
/*'use strict';

function doubleOddNumbers(numbers) {
// Replace this comment and the next line with your code
Expand All @@ -12,4 +12,29 @@ console.log(doubleOddNumbers(myNumbers));
module.exports = {
myNumbers,
doubleOddNumbers,
}; */

'use strict';

function doubleOddNumbers(numbers) {

numbers = numbers.filter(num => num % 2 === 1).map(num => num * 2);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job! But there seems to be many blank lines above and below. Can you delete?


console.log(numbers);

return numbers;



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

console.log(doubleOddNumbers(myNumbers));
module.exports = {

myNumbers,

doubleOddNumbers,

};

//finished
133 changes: 133 additions & 0 deletions Week2/homework/week2maartjes-work.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange spacing in this file too. Too many blank lines. Needs Prettier formatting.

'use strict';



const monday = [

{

name: 'Write a summary HTML/CSS',

duration: 180,

},

{

name: 'Some web development',

duration: 120,

},

{

name: 'Fix homework for class10',

duration: 20,

},

{

name: 'Talk to a lot of people',

duration: 200,

},

];



const tuesday = [

{

name: 'Keep writing summary',

duration: 240,

},

{

name: 'Some more web development',

duration: 180,

},

{

name: 'Staring out the window',

duration: 10,

},

{

name: 'Talk to a lot of people',

duration: 200,

},

{

name: 'Look at application assignments new students',

duration: 40,

},

];



const maartjesTasks = monday.concat(tuesday);

const maartjesHourlyRate = 20;



function computeEarnings(tasks, hourlyRate) {

const inHoursArr = tasks.map(task => task.duration / 60).filter(hours => hours <= 2);

const maartjesPayArr = inHoursArr.map(hours => hours * maartjesHourlyRate);

const totalPay = maartjesPayArr.reduce((sum, amount) => sum + amount);

const toEuro = totalPay.toFixed(2);

return toEuro;

}





const earnings = computeEarnings(maartjesTasks, maartjesHourlyRate);



//converting



console.log(`Martje has earned €${earnings}`);


module.exports = {

maartjesTasks,

maartjesHourlyRate,

computeEarnings,

};
36 changes: 34 additions & 2 deletions Week2/lecture-exercises.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,41 @@ async function getRandomAdvice() {
return adviceData.slip.advice;
}

let allAdvice=[]
const adviceEl = document.getElementById('advice');


function updateDOM() {
adviceEl.innerHTML= '';

allAdvice.forEach((advice, index)=> {


const adviceItem=document.createElement ('li')
adviceEl.appendChild(adviceItem);
adviceItem.innerText=advice;

const removeButton =document.createElement('button')
removeButton.innerText='remove';
adviceItem.appendChild(removeButton);
removeButton.addEventListener('click',() => deleteAdvice(index));_
})
}
function deleteAdvice (index){
allAdvice.splice(index,1);
updateDOM();
}
function upcaseAllAdvice (){
allAdvice=allAdvice.map(advice => advice.toUpperCase());
updateDOM();

async function setRandomAdvice() {
const adviceEl = document.getElementById('advice');
adviceEl.innerText = await getRandomAdvice();
allAdvice.push (await getRandomAdvice());
updateDOM();
}

setRandomAdvice();

document.getElementById('add-advice').addEventListener('click', setRandomAdvice);

document.getElementById('upcase-everything').addEventListener('click', upcaseAllAdvice);
12 changes: 4 additions & 8 deletions Week3/homework/step2-1.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
'use strict';

function foo(func) {
// What to do here?
// Replace this comment and the next line with your code
console.log(func);
func();
}

function bar() {

console.log('Hello, I am bar!');
}

foo(bar);

// Do not change or remove anything below this line
module.exports = foo;

//finished
Loading