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

Commit 3672d35

Browse files
committed
javaScript week 2 homewoerk
1 parent b7d2b54 commit 3672d35

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

Week2/homework/maartjes_work.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,13 @@ const tuesday = [
4545
const tasks = monday.concat(tuesday);
4646

4747
// Add your code here
48+
let twoHoursTasks = tasks.filter(x => x.duration >=120);
49+
//console.log(twoHoursTasks);
50+
51+
let totalWorkingTime = twoHoursTasks.map(x => x.duration);
52+
//console.log(totalWorkingTime);
53+
54+
const salaryPerHour = 25.5;
55+
56+
let totalSalary = totalWorkingTime.reduce((acc,val) => (acc + val)/60 * salaryPerHour,0)
57+
console.log( "The salary of Maartje is "+"€ " +totalSalary.toFixed(2))

Week2/homework/map_filter.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22

33
const numbers = [1, 2, 3, 4];
44

5-
// Add your code here
5+
let oddNumbers = numbers.filter(x => x % 2 !==0);
6+
console.log(oddNumbers);
7+
let doubleNumbers = oddNumbers.map(x => x*2);
8+
console.log('The doubled numbers are :', doubleNumbers)

0 commit comments

Comments
 (0)