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

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

Commit f64c111

Browse files
committed
changed < to > in overTwo
1 parent e2fc154 commit f64c111

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

Week2/homework/week2.js

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ let numbers = [1, 2, 3, 4];
77
let newNumbers = [];
88

99
for (let i = 0; i < numbers.length; i++) {
10-
if (numbers[i] % 2 !== 0) {
11-
newNumbers.push(numbers[i] * 2);
12-
}
10+
if (numbers[i] % 2 !== 0) {
11+
newNumbers.push(numbers[i] * 2);
12+
}
1313
}
1414

1515
console.log("The doubled numbers are", newNumbers); // [2, 6]
@@ -29,18 +29,18 @@ console.log("The doubled numbers are: " + times2);
2929
//Underneath you see a very interesting small insight in Maartje's work:
3030

3131
let monday = [
32-
{ name: 'Write a summary HTML/CSS', duration: 180 },
33-
{ name: 'Some web development', duration: 120 },
34-
{ name: 'Fix homework for class10', duration: 20 },
35-
{ name: 'Talk to a lot of people', duration: 200 }
32+
{ name: 'Write a summary HTML/CSS', duration: 180 },
33+
{ name: 'Some web development', duration: 120 },
34+
{ name: 'Fix homework for class10', duration: 20 },
35+
{ name: 'Talk to a lot of people', duration: 200 }
3636
];
3737

3838
let tuesday = [
39-
{ name: 'Keep writing summary', duration: 240 },
40-
{ name: 'Some more web development', duration: 180 },
41-
{ name: 'Staring out the window', duration: 10 },
42-
{ name: 'Talk to a lot of people', duration: 200 },
43-
{ name: 'Look at application assignments new students', duration: 40 }
39+
{ name: 'Keep writing summary', duration: 240 },
40+
{ name: 'Some more web development', duration: 180 },
41+
{ name: 'Staring out the window', duration: 10 },
42+
{ name: 'Talk to a lot of people', duration: 200 },
43+
{ name: 'Look at application assignments new students', duration: 40 }
4444
];
4545

4646
let tasks = monday.concat(tuesday);
@@ -49,39 +49,39 @@ console.log(tasks);
4949
// 2) Write a program that does the following below. Use map and filter. You will also need a forEach or a for loop for the 'summing up' part.
5050
/*Collect two days' worth of tasks.
5151
Convert the task durations to hours, instead of minutes.
52-
Filter out everything that took two hours or more (remove from the collection)
52+
Filter out everything that took less than two hours (i.e., remove from the collection)
5353
Multiply the each duration by a per-hour rate for billing (you can decide yourself what Maartje should make per hour) and sum it all up.
5454
Output a formatted Euro amount.
5555
Don't forget to use => */
5656
let thursday = [
57-
{ activity: "get kids ready for school", hours: 1 },
58-
{ activity: "drop off/pick up kids at school", hours: 1 },
59-
{ activity: "attend a meetup", hours: 3 },
60-
{ activity: "study for HYF", hours: 5 },
61-
{ activity: "cook dinner", hours: 1 },
62-
{ activity: "kid's bedtime routine", hours: 1 },
63-
{ activity: "relax, watch tv", hours: 3 },
57+
{ activity: "get kids ready for school", hours: 1 },
58+
{ activity: "drop off/pick up kids at school", hours: 1 },
59+
{ activity: "attend a meetup", hours: 3 },
60+
{ activity: "study for HYF", hours: 5 },
61+
{ activity: "cook dinner", hours: 1 },
62+
{ activity: "kid's bedtime routine", hours: 1 },
63+
{ activity: "relax, watch tv", hours: 3 },
6464
];
6565
let friday = [
66-
{ activity: "get kids ready for school", hours: 1 },
67-
{ activity: "drop off/pick up kids at school", hours: 1 },
68-
{ activity: "study for HYF", hours: 8 },
69-
{ activity: "cook dinner", hours: 1 },
70-
{ activity: "kid's bedtime routine", hours: 1 },
71-
{ activity: "go out with friends", hours: 4 },
66+
{ activity: "get kids ready for school", hours: 1 },
67+
{ activity: "drop off/pick up kids at school", hours: 1 },
68+
{ activity: "study for HYF", hours: 8 },
69+
{ activity: "cook dinner", hours: 1 },
70+
{ activity: "kid's bedtime routine", hours: 1 },
71+
{ activity: "go out with friends", hours: 4 },
7272
];
7373
let activities = thursday.concat(friday); //combines both arrays
7474
//console.log(activities);
7575

76-
let underTwo= activities.filter(item=> item.hours <= 2); // creates a new array that only includes the activities that were under 2 hours
77-
//console.log(underTwo);
76+
let overTwo = activities.filter(item => item.hours >= 2); // creates a new array that only includes the activities that took 2 hours or more
77+
//console.log(overTwo);
7878

79-
let hourlyRates= underTwo.map(item=> item.hours*25.00); // creates an array with the hourly rates
79+
let hourlyRates = underTwo.map(item => item.hours * 25.00); // creates an array with the hourly rates
8080
//console.log(hourlyRates);
8181

82-
let payment= hourlyRates.reduce( (accumulator, currentValue) => accumulator + currentValue ); //reduces payment to 200 which is all the hourly rates combined
82+
let payment = hourlyRates.reduce((accumulator, currentValue) => accumulator + currentValue); //reduces payment to 200 which is all the hourly rates combined
8383

84-
let totalEuros= payment.toLocaleString('en-US', {style: 'currency', currency: 'EUR'});
84+
let totalEuros = payment.toLocaleString('en-US', { style: 'currency', currency: 'EUR' });
8585
//console.log(totalEuros); //200 euros
8686

8787
console.log("I would get paid: " + totalEuros);

0 commit comments

Comments
 (0)