diff --git a/01/app.js b/01/app.js index e69de29..1fc15b8 100644 --- a/01/app.js +++ b/01/app.js @@ -0,0 +1,6 @@ +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..b1be5c8 100644 --- a/02/app.js +++ b/02/app.js @@ -0,0 +1,5 @@ +function sayHello(name) { + console.log("Cześć " + name + "!"); +} + +sayHello('Piotr'); \ No newline at end of file diff --git a/03/app.js b/03/app.js index e69de29..ab53dca 100644 --- a/03/app.js +++ b/03/app.js @@ -0,0 +1,9 @@ +const sumTo = function(limit) { + let sum = 0; + for (let i = 1; i <= limit; i++) { + sum = sum+i; + } + return sum; +}; + +console.log(sumTo(5)); \ No newline at end of file diff --git a/04/app.js b/04/app.js index e69de29..47e041a 100644 --- a/04/app.js +++ b/04/app.js @@ -0,0 +1,15 @@ +function runTimer() { + let count = 0; + const intervalId = setInterval(function() { + const time = new Date().toLocaleTimeString(); + console.log(time); + + count++; + + if (count === 5) { + clearInterval(intervalId); + } + }, 5000); +} + +runTimer(); \ No newline at end of file