diff --git a/01/app.js b/01/app.js index e69de29..73bb077 100644 --- a/01/app.js +++ b/01/app.js @@ -0,0 +1,6 @@ +function showTime() { + const time = (new Date()).toLocaleTimeString(); + console.log(time); +} + +showTime(); diff --git a/02/app.js b/02/app.js index e69de29..b86ef8c 100644 --- a/02/app.js +++ b/02/app.js @@ -0,0 +1,4 @@ +function sayHello(name){ + console.log('cześć ${name}!') +} +sayHello(devmentor.pl) \ No newline at end of file diff --git a/03/app.js b/03/app.js index e69de29..863dadf 100644 --- a/03/app.js +++ b/03/app.js @@ -0,0 +1,10 @@ +const sumNumbersUpTo = function(n) { + let sum = 0; + for (let i = 1; i <= n; i++) { + sum += i; + } + return sum; +}; + +const result = sumNumbersUpTo(4); +console.log(result); \ No newline at end of file diff --git a/04/app.js b/04/app.js index e69de29..7128467 100644 --- a/04/app.js +++ b/04/app.js @@ -0,0 +1,16 @@ +function runTimer() { + let counter = 0; + + const intervalId = setInterval(function () { + const time = new Date().toLocaleTimeString(); + console.log(time); + + counter++; + + if (counter === 5) { + clearInterval(intervalId); + } + }, 5000); +} + +runTimer();