From cfbb06a241d0476dce30144f92cdb82bd74359b7 Mon Sep 17 00:00:00 2001 From: Mariusz Date: Tue, 4 Jun 2024 19:42:28 +0200 Subject: [PATCH 1/4] add function in task01 --- 01/app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/01/app.js b/01/app.js index e69de29..6b32184 100644 --- a/01/app.js +++ b/01/app.js @@ -0,0 +1,5 @@ +function showTime() { + const time = (new Date()).toLocaleTimeString(); + console.log(time); +} +showTime(); \ No newline at end of file From bd8dbd4273d28213a587a58b34b5933e20e0a3c8 Mon Sep 17 00:00:00 2001 From: Mariusz Date: Tue, 4 Jun 2024 20:20:50 +0200 Subject: [PATCH 2/4] add function in task02 --- 02/app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/02/app.js b/02/app.js index e69de29..0b7fbcd 100644 --- a/02/app.js +++ b/02/app.js @@ -0,0 +1,5 @@ +function sayHello(text) { + console.log('Cześć ' + text + '!'); +} + +sayHello('devmentor.pl') \ No newline at end of file From 6050b90ec279b559264581a1e08c9411925c4a34 Mon Sep 17 00:00:00 2001 From: Mariusz Date: Wed, 5 Jun 2024 09:09:12 +0200 Subject: [PATCH 3/4] add function in task03 --- 03/app.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/03/app.js b/03/app.js index e69de29..8bd90d1 100644 --- a/03/app.js +++ b/03/app.js @@ -0,0 +1,11 @@ +const numberOfCycleCounts = function(numberOfCycles) { + let sum = 0; + + for (i = 0; i < numberOfCycles; i++) { + sum = sum + (i+1); + } + + return sum; +} + +console.log(numberOfCycleCounts(4)); \ No newline at end of file From f4e4a0c9de1939276ab5328f495379c16fc294a3 Mon Sep 17 00:00:00 2001 From: Mariusz Date: Wed, 5 Jun 2024 10:13:49 +0200 Subject: [PATCH 4/4] add function in task04 --- 04/app.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/04/app.js b/04/app.js index e69de29..934d573 100644 --- a/04/app.js +++ b/04/app.js @@ -0,0 +1,18 @@ +function runTimer() { + + let idInterval; + let counter = 5; + + const time = function() { + if (counter == 0) { + clearInterval(idInterval); + } else { + console.log((new Date()).toLocaleTimeString()); + counter--; + } + } + + idInterval = setInterval(time,5000); + +} +runTimer(); \ No newline at end of file