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
21 changes: 13 additions & 8 deletions 21 Week2/homework/maartjes-work.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,26 @@ const tuesday = [
duration: 40,
},
];

/* cSpell:disable */
const maartjesTasks = monday.concat(tuesday);
const maartjesHourlyRate = 20;

function computeEarnings(tasks, hourlyRate) {
// Replace this comment and the next line with your code
console.log(tasks, hourlyRate);
tasks = tasks
.map(durations => durations.duration / 60)
.filter(durations => durations >= 2)
.map(durations => durations * hourlyRate)
.reduce((taskEarnings, taskEarning) => taskEarnings + taskEarning);
return tasks;
}

// 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'}`);
// earnings.toFixed(2);
const formattedEarnings = Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'EUR',
}).format(earnings);
console.log(`Maartje has earned ${formattedEarnings}`);

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

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

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