From d60faed70ffdc7da24076081b0e03e32d16f24e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Ko=C5=82tuniak?= Date: Mon, 16 Feb 2026 19:26:31 +0100 Subject: [PATCH 1/5] add task 1 --- 01/app.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/01/app.js b/01/app.js index e69de29..a497bfc 100644 --- a/01/app.js +++ b/01/app.js @@ -0,0 +1,6 @@ +const users = ['Jan Kowalski', 'Monika Wysocka', 'Adam Nowak', 'Michał Ozimek', 'Dorota Rudzińska', 'Agata Borsuk']; + +console.log(users[0]); +console.log(users[2]); +console.log(users[4]); +console.log('Liczba elementów tablicy:', users.length); From e0fa8a55dcfb3096c5702a51194d5bae8f71d6ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Ko=C5=82tuniak?= Date: Mon, 16 Feb 2026 19:50:50 +0100 Subject: [PATCH 2/5] add task 2 --- 02/app.js | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/02/app.js b/02/app.js index 9ad302b..268de64 100644 --- a/02/app.js +++ b/02/app.js @@ -1,6 +1,20 @@ const randomArray = createRandomArray(); console.log(randomArray); +// wyświetlenie w konsoli wszystkich elementów tablicy przy pomocy pętli for + +for (let i = 0; i < randomArray.length; i++) { + console.log(randomArray[i]); +} + +// wyświetlenie w konsoli wszystkich elementów tablicy przy pomocy metody tablicowej .forEach() + +randomArray.forEach(el => console.log(el)); + +// wyświetl wartość ostatniego elementu tablicy +console.log(randomArray[randomArray.length - 1]); + + // nie modyfikuj kodu poniżej! @@ -9,15 +23,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, 16 Feb 2026 20:10:52 +0100 Subject: [PATCH 3/5] add task 3 --- 03/app.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/03/app.js b/03/app.js index cebcbc2..1816772 100644 --- a/03/app.js +++ b/03/app.js @@ -1,2 +1,11 @@ const n = 24; -const oddNumbers = []; \ No newline at end of file +const oddNumbers = []; + +for (let i = 1; i <= n; i++) { + if (i % 2) { + oddNumbers.push(i); + } +} + +console.log(oddNumbers); +console.log('długość tablicy:', oddNumbers.length); From 205f9795b0695a40368fff5e7277cc5e1a81319a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Ko=C5=82tuniak?= Date: Mon, 16 Feb 2026 20:21:28 +0100 Subject: [PATCH 4/5] add task 4 --- 04/app.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/04/app.js b/04/app.js index 8285afd..186344c 100644 --- a/04/app.js +++ b/04/app.js @@ -1 +1,7 @@ -const years = [1980, 1934, 2002, 2019]; \ No newline at end of file +const years = [1980, 1934, 2002, 2019]; + +const currYear = new Date().getFullYear(); + +const newArr = years.map(year => currYear - year); + +console.log(newArr); From 3c5b96465092d3735ff57613b4af45fd4e3c9cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Ko=C5=82tuniak?= Date: Mon, 16 Feb 2026 20:27:38 +0100 Subject: [PATCH 5/5] add task 5 --- 05/app.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/05/app.js b/05/app.js index 1c6bb90..a666bb7 100644 --- a/05/app.js +++ b/05/app.js @@ -1 +1,5 @@ -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 evenSum = numbers.filter(num => num % 2 === 0).reduce((acc, curr) => acc + curr, 0); + +console.log(evenSum);