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 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 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 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