From 0d27bbfbc7c32ddb96a35d9a30629785712c0149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Godzi=C5=84ski?= Date: Tue, 30 Jan 2018 20:47:58 +0100 Subject: [PATCH 1/7] Zadanie 01 - done --- app/zadanie01.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/zadanie01.js b/app/zadanie01.js index 8c20173..fb62126 100644 --- a/app/zadanie01.js +++ b/app/zadanie01.js @@ -1 +1,7 @@ -//Twój kod \ No newline at end of file +//Twój kod + +console.log("Filip Godziński") + +const helloText = setTimeout( () => { + console.log("wita się z Node.js!"); +}, 5000); \ No newline at end of file From 26dee95a8444ebc3cd2ae36bcadfc82eec14e0db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Godzi=C5=84ski?= Date: Tue, 30 Jan 2018 20:48:15 +0100 Subject: [PATCH 2/7] Zadanie 02 - done --- app/zadanie02.js | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/app/zadanie02.js b/app/zadanie02.js index 8c20173..68f6baf 100644 --- a/app/zadanie02.js +++ b/app/zadanie02.js @@ -1 +1,31 @@ -//Twój kod \ No newline at end of file +//Twój kod + +const text1 = setTimeout( () => { + console.log("Node.js"); +}, 4000); + +const text2 = setTimeout( () => { + console.log("się"); +}, 1000); + +console.log("Witam"); + +const text3 = setTimeout( () => { + console.log("i korzystam"); +}, 6000); + +const text4 = setTimeout( () => { + console.log("w konsoli"); +}, 5000); + +const text5 = setTimeout( () => { + console.log("z funkcji czasu!"); +}, 7000); + +const text6 = setTimeout( () => { + console.log("z"); +}, 2000); + +const text7 = setTimeout( () => { + console.log("programem"); +}, 3000); \ No newline at end of file From 07724702539d84f49cad4b89e23a905c8c633803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Godzi=C5=84ski?= Date: Tue, 30 Jan 2018 20:48:31 +0100 Subject: [PATCH 3/7] Zadanie 03 - done --- app/zadanie03.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/zadanie03.js b/app/zadanie03.js index 8c20173..0fbaa9a 100644 --- a/app/zadanie03.js +++ b/app/zadanie03.js @@ -1 +1,9 @@ -//Twój kod \ No newline at end of file +//Twój kod + +let sum = 0; + +for(let i=2; i Date: Tue, 30 Jan 2018 20:48:51 +0100 Subject: [PATCH 4/7] Zadanie Dnia - done --- app/zadanieDnia.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/zadanieDnia.js b/app/zadanieDnia.js index 8c20173..29ce6d3 100644 --- a/app/zadanieDnia.js +++ b/app/zadanieDnia.js @@ -1 +1,7 @@ -//Twój kod \ No newline at end of file +//Twój kod + +for(let i=2; i { + console.log(Number(process.argv[i])); + }, Number(process.argv[i])*1000); +} From 6c826da4d0324233de1586d32059f58eea3117df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Godzi=C5=84ski?= Date: Wed, 31 Jan 2018 10:20:45 +0100 Subject: [PATCH 5/7] simpler solution --- app/zadanie02.js | 45 ++++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/app/zadanie02.js b/app/zadanie02.js index 68f6baf..9a75f78 100644 --- a/app/zadanie02.js +++ b/app/zadanie02.js @@ -1,31 +1,18 @@ //Twój kod -const text1 = setTimeout( () => { - console.log("Node.js"); -}, 4000); - -const text2 = setTimeout( () => { - console.log("się"); -}, 1000); - -console.log("Witam"); - -const text3 = setTimeout( () => { - console.log("i korzystam"); -}, 6000); - -const text4 = setTimeout( () => { - console.log("w konsoli"); -}, 5000); - -const text5 = setTimeout( () => { - console.log("z funkcji czasu!"); -}, 7000); - -const text6 = setTimeout( () => { - console.log("z"); -}, 2000); - -const text7 = setTimeout( () => { - console.log("programem"); -}, 3000); \ No newline at end of file +const arrText = { + 4: "Node.js", + 1: "się", + 0: "Witam", + 6: "i korzystam", + 5: "w konsoli", + 7: "z funkcji czasu!", + 2: "z", + 3: "programem" +}; + +for (let i in arrText) { + setTimeout( () => { + console.log(arrText[i]); + }, i*1000); +} \ No newline at end of file From 167f0bdacd63f29b6578dc68bf1fb051c7a4127e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Godzi=C5=84ski?= Date: Wed, 31 Jan 2018 10:21:18 +0100 Subject: [PATCH 6/7] simpler solution --- app/zadanie03.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/zadanie03.js b/app/zadanie03.js index 0fbaa9a..f11fdfc 100644 --- a/app/zadanie03.js +++ b/app/zadanie03.js @@ -2,8 +2,11 @@ let sum = 0; -for(let i=2; i { + if (index >= 2) { + sum += Number(element); + } +}); console.log(sum); + From 48e1ce53bdc16d7a118929326f3be37e64c005da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Godzi=C5=84ski?= Date: Wed, 31 Jan 2018 10:21:38 +0100 Subject: [PATCH 7/7] simpler solution --- app/zadanieDnia.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/zadanieDnia.js b/app/zadanieDnia.js index 29ce6d3..9b292bd 100644 --- a/app/zadanieDnia.js +++ b/app/zadanieDnia.js @@ -1,7 +1,9 @@ //Twój kod -for(let i=2; i { - console.log(Number(process.argv[i])); - }, Number(process.argv[i])*1000); -} +const showNum = process.argv.forEach( (element, index) => { + if (index >= 2) { + setTimeout( () => { + console.log(Number(element)); + }, Number(element)*1000); + } +}); \ No newline at end of file