diff --git a/01/app.js b/01/app.js index e69de29..63d6441 100644 --- a/01/app.js +++ b/01/app.js @@ -0,0 +1,7 @@ +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..594617f 100644 --- a/02/app.js +++ b/02/app.js @@ -0,0 +1,7 @@ +function sayHello() { + let name = (prompt('podaj imie')) + + console.log ('Cześć', name + '!' ) +} + +sayHello(name) \ No newline at end of file diff --git a/03/app.js b/03/app.js index e69de29..d8f21da 100644 --- a/03/app.js +++ b/03/app.js @@ -0,0 +1,12 @@ +const sumToNumber = function(x) { + let result = 0; + for(let i=1; i <= x; i++) { + result = result + i; + + } + return result + +} + +const res = sumToNumber(4) +console.log(res) \ No newline at end of file diff --git a/04/app.js b/04/app.js index e69de29..be483a8 100644 --- a/04/app.js +++ b/04/app.js @@ -0,0 +1,17 @@ +function runTimer() { + console.log('start'); + let iteration = 0; + const idInterval = setInterval(function() { + const time = (new Date()).toLocaleTimeString(); + console.log(time); + + iteration ++; + console.log (iteration); + + if(iteration === 5) { + clearInterval(idInterval) + } + }, 1000) +} + +runTimer() \ No newline at end of file