diff --git a/01/app.js b/01/app.js index e69de29..710f0f4 100644 --- a/01/app.js +++ b/01/app.js @@ -0,0 +1,6 @@ +function showTime() { + const time = new Date().toLocaleDateString(); + console.log(time); +} + +showTime(); diff --git a/02/app.js b/02/app.js index e69de29..c810c4d 100644 --- a/02/app.js +++ b/02/app.js @@ -0,0 +1,5 @@ +function sayHello(name) { + console.log(`Cześć ${name}!`); +} + +sayHello("devmentor.pl"); diff --git a/03/app.js b/03/app.js index e69de29..97e79c2 100644 --- a/03/app.js +++ b/03/app.js @@ -0,0 +1,16 @@ +const sumNum = function (num) { + let resultStr = ""; + let sum = 0; + for (let i = 1; i <= num; i++) { + sum += i; + resultStr += i; + if (i == num) { + break; + } + resultStr += "+"; + } + resultStr += "=" + sum; + return resultStr; +}; + +console.log(sumNum(4)); diff --git a/04/app.js b/04/app.js index e69de29..89b1e70 100644 --- a/04/app.js +++ b/04/app.js @@ -0,0 +1,14 @@ +let idInterval; +let counter = 0; + +runTimer = function () { + counter++; + if (counter > 5) { + clearInterval(idInterval); + console.log("Timer has been ended."); + return; + } + console.log(`${counter}: ${Date()}`); +}; + +idInterval = setInterval(runTimer, 5000);