From b740f75e95a828b2db1312b0669dfa698c5e5aec Mon Sep 17 00:00:00 2001 From: Artur Date: Mon, 29 Sep 2025 08:54:00 +0200 Subject: [PATCH 1/5] Task 01 completed --- 01/app.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/01/app.js b/01/app.js index e69de29..5fd3c93 100644 --- a/01/app.js +++ b/01/app.js @@ -0,0 +1,9 @@ +let users = [ + 'Jan Kowalski', + 'Grzegorz Małolepszy', + 'Adam Nieproszony', + 'Katarzyna Nowak', + 'Olga Zarzeczna', +]; + +console.log(users[0], users[2], users[4], users.length); From ee78b032e35ee6837787338cf85931ac6149a211 Mon Sep 17 00:00:00 2001 From: Artur Date: Mon, 29 Sep 2025 09:02:30 +0200 Subject: [PATCH 2/5] Task 02 comppleted --- 02/app.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/02/app.js b/02/app.js index 9ad302b..960a8e5 100644 --- a/02/app.js +++ b/02/app.js @@ -1,7 +1,15 @@ const randomArray = createRandomArray(); console.log(randomArray); +for (let i = 0; i <= randomArray.length - 1; i++) { + console.log(randomArray[i]); +} + +randomArray.forEach((num) => { + console.log(num); +}); +console.log(randomArray[randomArray.length - 1]); // nie modyfikuj kodu poniżej! @@ -9,15 +17,15 @@ console.log(randomArray); // ponieważ w JS występuje mechanizm tzw. hoisting-u function createRandomArray() { - const arr = []; - const len = getRandomInteger(1, 10) - for(let i=0; i Date: Mon, 29 Sep 2025 09:10:59 +0200 Subject: [PATCH 3/5] Task 03 comppleted --- 03/app.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/03/app.js b/03/app.js index cebcbc2..e3f7d23 100644 --- a/03/app.js +++ b/03/app.js @@ -1,2 +1,8 @@ const n = 24; -const oddNumbers = []; \ No newline at end of file +const oddNumbers = []; + +for (let i = 1; i <= n; i += 2) { + oddNumbers.push(i); +} + +console.log(oddNumbers); From fb514e8540ff7fa71b8a2275a0f450b58a0cc571 Mon Sep 17 00:00:00 2001 From: Artur Date: Mon, 29 Sep 2025 09:19:05 +0200 Subject: [PATCH 4/5] Task 04 completed --- 04/app.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/04/app.js b/04/app.js index 8285afd..2ca7258 100644 --- a/04/app.js +++ b/04/app.js @@ -1 +1,3 @@ -const years = [1980, 1934, 2002, 2019]; \ No newline at end of file +const years = [1980, 1934, 2002, 2019]; +const currentYear = new Date().getFullYear(); +const howLong = years.map((year) => currentYear - year); From 3c2a9f46e7ffe31c9f463c998fadb69d019cc5ba Mon Sep 17 00:00:00 2001 From: Artur Date: Mon, 29 Sep 2025 09:22:27 +0200 Subject: [PATCH 5/5] Task 05 completed --- 05/app.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/05/app.js b/05/app.js index 1c6bb90..d5877bf 100644 --- a/05/app.js +++ b/05/app.js @@ -1 +1,7 @@ -const numbers = [1, 2, 3, 4, 5, 6, 7]; \ No newline at end of file +const numbers = [1, 2, 3, 4, 5, 6, 7]; + +const sum = numbers + .filter((num) => num % 2 === 0) + .reduce((prev, curr) => curr + prev); + +console.log(sum);