Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a75df88

Browse files
committed
maartjes_work homework added
1 parent dd4302c commit a75df88

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Week2/homework/maartjes_work.js

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

4747
// Add your code here
48+
49+
//1. Map the tasks to durations in hours:
50+
51+
const taskMapping = tasks.map((i) => i.duration / 60)
52+
53+
//2. Filter out everything that took less than two hours:
54+
55+
const plusTwoHour = taskMapping.filter((i) => i >= 2)
56+
57+
//3. Multiply the each duration by a per-hour rate for billing and sum it all up.
58+
59+
let maartjteRate = 9.67;
60+
const maartjteSalary = plusTwoHour.reduce((sum,i) => {return sum + i * maartjteRate}, 0)
61+
62+
//4. Output a formatted Euro amount, rounded to Euro cents:
63+
64+
let euroFormat = "€" + (maartjteSalary * 10.31).toFixed(2)
65+
console.log(euroFormat);

0 commit comments

Comments
 (0)