Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit 2a97d3a

Browse files
committed
test pr homework from unmesh
1 parent a88dec3 commit 2a97d3a

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎Week2/homework/maartjes-work.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,18 @@ const maartjesTasks = monday.concat(tuesday);
4646
const maartjesHourlyRate = 20;
4747

4848
function computeEarnings(tasks, hourlyRate) {
49-
// Replace this comment and the next line with your code
50-
console.log(tasks, hourlyRate);
49+
return tasks
50+
.map(task => task.duration / 60)
51+
.filter(duration => duration >= 2)
52+
.reduce((totalBill, durationInHours) => totalBill + durationInHours * hourlyRate, 0);
5153
}
5254

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

5658
// add code to convert `earnings` to a string rounded to two decimals (euro cents)
57-
58-
console.log(`Maartje has earned €${'replace this string with the earnings rounded to euro cents'}`);
59+
const earningsInString = earnings.toFixed(2);
60+
console.log(`Maartje has earned €${earningsInString}`);
5961

6062
// Do not change or remove anything below this line
6163
module.exports = {

‎Week2/homework/map-filter.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
'use strict';
22

33
function doubleOddNumbers(numbers) {
4-
// Replace this comment and the next line with your code
5-
console.log(numbers);
4+
return numbers.filter(number => number % 2 !== 0).map(number => number * 2);
65
}
76

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

0 commit comments

Comments
 (0)