diff --git a/01/app.js b/01/app.js index e69de29..c3ce0db 100644 --- a/01/app.js +++ b/01/app.js @@ -0,0 +1,6 @@ +function showCurrentTime() { + const time = new Date().toLocaleTimeString(); + console.log(time); +} + +showCurrentTime(); diff --git a/02/app.js b/02/app.js index e69de29..bac3370 100644 --- a/02/app.js +++ b/02/app.js @@ -0,0 +1,4 @@ +function sayHello(firstName) { + console.log(`Cześć ${firstName}!`); +} +sayHello("Natalia"); diff --git a/03/app.js b/03/app.js index e69de29..2f0a1b3 100644 --- a/03/app.js +++ b/03/app.js @@ -0,0 +1,9 @@ +const sumNumbers = function (maxNumber) { + let sum = 0; + for (let i = 1; i <= maxNumber; i++) { + sum = sum + i; + } + return sum; +}; + +console.log(sumNumbers(5)); diff --git a/04/app.js b/04/app.js index e69de29..fbd88ff 100644 --- a/04/app.js +++ b/04/app.js @@ -0,0 +1,12 @@ +const runTimer = function () { + let counter = 0; + let timerId = setInterval(function () { + const time = new Date().toLocaleTimeString(); + console.log(time); + counter++; + if (counter >= 5) { + clearInterval(timerId); + } + }, 5000); +}; +runTimer();