diff --git a/01/app.js b/01/app.js index e69de29..52b8192 100644 --- a/01/app.js +++ b/01/app.js @@ -0,0 +1,6 @@ +const showTime = function() { + 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..e6b18c3 100644 --- a/02/app.js +++ b/02/app.js @@ -0,0 +1,6 @@ +const sayHello = function(userName) { + console.log("Cześć", userName, "!"); +} + +sayHello('devmentor.pl'); + diff --git a/03/app.js b/03/app.js index e69de29..7eb4903 100644 --- a/03/app.js +++ b/03/app.js @@ -0,0 +1,10 @@ +const sumNumbers = function(x) { + let result = 0; + + for(let i = 0; i <= x; i++ ) { + result += i; + } + + return result; +} +console.log(sumNumbers(4)); \ No newline at end of file diff --git a/04/app.js b/04/app.js index e69de29..e742b29 100644 --- a/04/app.js +++ b/04/app.js @@ -0,0 +1,15 @@ +let counter = 0; + +const runTimer = function() { + const time = (new Date()).toLocaleTimeString(); + console.log(time); + counter++; + console.log(counter); + + if(counter >= 5) { + clearInterval(intervalId); + console.log("Timer stop!"); + } +} + +const intervalId = setInterval(runTimer, 5000); \ No newline at end of file