Skip to content

Commit 8f2907d

Browse files
committed
added step6 week7
1 parent 7a8edcf commit 8f2907d

File tree

1 file changed

+91
-4
lines changed

1 file changed

+91
-4
lines changed

Week7/MAKEME.md

Lines changed: 91 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,96 @@ Give feedback on the SPA (Github API) and git branching homework of one of you f
2929

3030
3. [Iterate over Arrays with map](https://www.freecodecamp.com/challenges/iterate-over-arrays-with-map)
3131

32-
## Step 6: Pair programming assignment!!!!!! (TBA before Thursday)
33-
<!-- ## Step 6: Code Kata Race
32+
## Step 6: More, map filter reduce and =>
33+
34+
1. Say you would like to write a program that doubles the odd numbers in an array and throws away the even number.
35+
36+
Your solution could be something like this:
37+
```js
38+
let numbers = [1, 2, 3, 4];
39+
let newNumbers = [];
40+
41+
for(let i = 0; i < numbers.length; i++) {
42+
if(numbers[i] % 2 !== 0) {
43+
newNumbers[i] = numbers[i] * 2;
44+
}
45+
}
46+
47+
console.log("The doubled numbers are", newNumbers); // [2, 6]
48+
49+
```
50+
51+
rewrite the above program using `map` and `filter` don't forget to use `=>`
52+
53+
2. Use the array of the previous assignment, write a program that add the even numbers to the resulting array twice, but the odd numbers only once. Don't forget to use `=>`.
54+
55+
Your output should be:
56+
```js
57+
console.log("The final numbers are", newNumbers);// [1, 2, 2, 3, 4, 4]
58+
```
59+
60+
Underneath you see a very interesting small insight in Maartje's work:
61+
```js
62+
let monday = [
63+
{
64+
name : 'Write a summary HTML/CSS',
65+
duration : 180
66+
},
67+
{
68+
name : 'Some web development',
69+
duration : 120
70+
},
71+
{
72+
name : 'Try to convince teachers to fix homework class10',
73+
duration : 30
74+
},
75+
{
76+
name : 'Fix homework for class10 myself',
77+
duration : 20
78+
},
79+
{
80+
name : 'Talk to a lot of people',
81+
duration : 200
82+
}
83+
];
84+
85+
let tuesday = [
86+
{
87+
name : 'Keep writing summery',
88+
duration : 240
89+
},
90+
{
91+
name : 'Some more web development',
92+
duration : 180
93+
},
94+
{
95+
name : 'Staring out the window',
96+
duration : 10
97+
},
98+
{
99+
name : 'Talk to a lot of people',
100+
duration : 200
101+
},
102+
{
103+
name : 'Look at application assignments new students',
104+
duration : 40
105+
}
106+
];
107+
108+
let tasks = [monday, tuesday];
109+
```
110+
111+
3. Write a program that does the following:
112+
113+
- Collect two days' worth of tasks.
114+
- Convert the task durations to hours, instead of minutes.
115+
- Filter out everything that took two hours or more.
116+
- Sum it all up.
117+
- Multiply the result by a per-hour rate for billing (you can decide yourself what Maartje should make per hour).
118+
- Output a formatted Euro amount.
119+
- Don't forget to use `=>`
120+
121+
_BONUS_ : Code Kata Race
34122

35123
If you haven't already join our clan: "Hack Your Future" in codewars
36124

@@ -48,8 +136,7 @@ _Hints_
48136

49137
Remember the person with the most kata points gets a prize from Gijs (and you can do exercises on this website without us assigning them - anything kyu 7 or kyu 8 you can try to do - kyu 6 or lower is probably too hard) -->
50138

51-
_BONUS_
52-
[BONUS](https://www.codewars.com/collections/hyf-homework-1-bonus-credit) :collision:
139+
-[MORE BONUS](https://www.codewars.com/collections/hyf-homework-1-bonus-credit) :collision:
53140

54141
## To watch before the next lecture:
55142

0 commit comments

Comments
 (0)