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
Open
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
10 changes: 8 additions & 2 deletions 10 Week2/homework/maartjes-work.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,21 @@ const maartjesHourlyRate = 20;

function computeEarnings(tasks, hourlyRate) {
// Replace this comment and the next line with your code
console.log(tasks, hourlyRate);
const maartjesTasks = tasks.map(elem => ({ ...elem, duration: elem.duration / 60 }));
const filteredTasks = maartjesTasks.filter(elem => elem.duration > 2);
const sumEarning = filteredTasks.reduce((acc, elem) => {
const earning = elem.duration * hourlyRate;
return acc + earning;
}, 0);
return sumEarning;
}

// eslint-disable-next-line no-unused-vars
const earnings = computeEarnings(maartjesTasks, maartjesHourlyRate);

// add code to convert `earnings` to a string rounded to two decimals (euro cents)

console.log(`Maartje has earned €${'replace this string with the earnings rounded to euro cents'}`);
console.log(`Maartje has earned €${earnings.toFixed(2)}`);

// Do not change or remove anything below this line
module.exports = {
Expand Down
6 changes: 4 additions & 2 deletions 6 Week2/homework/map-filter.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use strict';

function doubleOddNumbers(numbers) {
// Replace this comment and the next line with your code
console.log(numbers);
var filteredNumbered = numbers.filter(elem => elem % 2 !== 0);
var doubledNumber = filteredNumbered.map(elem => elem * 2);
return doubledNumber;
}
// console.log(numbers);

const myNumbers = [1, 2, 3, 4];
console.log(doubleOddNumbers(myNumbers));
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.