Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
18 changes: 18 additions & 0 deletions 18 Week2/homework/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>

<head>
<title>week2JS</title>
<meta charset="utf-8" />


</head>

<body>


<script type="text/javascript" src="maartjes_work.js"></script>
<script type="text/javascript" src="map_filter.js"></script>
</body>

</html>
90 changes: 50 additions & 40 deletions 90 Week2/homework/maartjes_work.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,57 @@
'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 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 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 tasks = monday.concat(tuesday);
const tasks = monday.concat(tuesday)
let minutesToHours = tasks.filter(a => a.duration >= 120).map(h => h.duration / 60);

Choose a reason for hiding this comment

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

You mixed up the order of first 2 steps here. While that does not matter much in this case, you should read the instructions carefully.


// Add your code here
console.log(minutesToHours);

let perHour = minutesToHours.map(v => v * 23) // per hour 23 euro

Choose a reason for hiding this comment

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

You should always have meaningful names for the variables, 'v' is not an intuitive name.


console.log(perHour);

let total = perHour.reduce(function(a, b) {

Choose a reason for hiding this comment

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

You should have used '=>' function here instead of 'function()', that's what the assignment mentioned.

return a + b;

});
total = total.toFixed(2); //rounding number
console.log("Maartje totally will earn: " + total + " Euro");
5 changes: 4 additions & 1 deletion 5 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

const newNumbers = numbers.filter(w => w % 2 !== 0).map(x => x * 2);

Choose a reason for hiding this comment

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

Another example of non-intuitive naming :)


console.log('The doubled numbers are: ' + newNumbers);
Morty Proxy This is a proxified and sanitized view of the page, visit original site.