From 98da4eca58413f85620519a9e9953f974761c4da Mon Sep 17 00:00:00 2001 From: Nebiyoutibebu <45137309+Nebiyoutibebu@users.noreply.github.com> Date: Sun, 17 Feb 2019 10:04:47 +0100 Subject: [PATCH 1/2] Create week 2 --- week 2 | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 week 2 diff --git a/week 2 b/week 2 new file mode 100644 index 000000000..8566707c8 --- /dev/null +++ b/week 2 @@ -0,0 +1,7 @@ +Step 1: + +const numbers = [1, 2, 3, 4]; +const oddnumbers = numbers.filter(item => Math.abs(item) % 2 === 1) +const doubleOddNumbers = oddnumbers.map(item => item * 2) + +console.log(doubleOddNumbers) From ecda530bfd37bb44ed155c6f4a2fb0c4654d9ac0 Mon Sep 17 00:00:00 2001 From: Nebiyoutibebu <45137309+Nebiyoutibebu@users.noreply.github.com> Date: Sun, 9 Jun 2019 08:49:12 +0200 Subject: [PATCH 2/2] Rename week 2 to week_2 --- week_2 | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 week_2 diff --git a/week_2 b/week_2 new file mode 100644 index 000000000..9a07a717b --- /dev/null +++ b/week_2 @@ -0,0 +1,73 @@ +1.1 + +function doubleOddNumbers(numbers) { + console.log(numbers); + return numbers.filter(num => num % 2 !== 0).map(num => num * 2); + } + const myNumbers = [1, 2, 3, 4]; + console.log(doubleOddNumbers(myNumbers)); + + + + + 1.2 + + const monday = [ + { + name: "Write a summary HTML/CSS", + duration: 180 + }, + { + name: "Some web development", + duration: 120 + }, + { + name: "Fix homework for class10", + duration: 20 + }, + { + name: "Talk to a lot of people", + duration: 200 + } +]; + +const tuesday = [ + { + name: "Keep writing summary", + duration: 240 + }, + { + name: "Some more web development", + duration: 180 + }, + { + name: "Staring out the window", + duration: 10 + }, + { + name: "Talk to a lot of people", + duration: 200 + }, + { + name: "Look at application assignments new students", + duration: 40 + } +]; + +const tasks = [...monday, ...tuesday]; +const rate = 20; +const tasksInHour = tasks + .map(i => i.duration / 60) + .filter(i => i >= 2) + .map(i => i * rate) + .reduce((total, value) => total + value) + .toFixed(2); + +console.log(`€ ${tasksInHour}`); + +// 60, 40, 66.66666, 80, 60, 66.6666 +// total , value , result +// iteration 0 ... total = 60, value = 40 ---> 100 +// iteration 1 ... total = 100, value = 66.66 --> 166.666 +// iteration 2 ... total = 166.666, value = 80 --> 246.666 +// iteration n .. total = something number