diff --git a/01/app.js b/01/app.js index e69de29..59335cf 100644 --- a/01/app.js +++ b/01/app.js @@ -0,0 +1,9 @@ +function showTime() { + console.log('showTime'); + + const time = (new Date()).toLocaleTimeString(); + console.log(time); +} + +showTime(); + diff --git a/02/app.js b/02/app.js index e69de29..cfba209 100644 --- a/02/app.js +++ b/02/app.js @@ -0,0 +1,5 @@ +function sayHello(name){ +console.log('Cześć ' + name + '!') +} + +sayHello('devmentor.pl') \ No newline at end of file diff --git a/03/app.js b/03/app.js index e69de29..247a598 100644 --- a/03/app.js +++ b/03/app.js @@ -0,0 +1,16 @@ +const getSum = function(limit) { + console.log(limit); + + let result = 0; + for(let i=1; i<=limit; i++) { + result = result + i; + } + + return result; +} + +const res1 = getSum(4); +console.log(res1); + +const res2 = getSum(5); +console.log(res2); \ No newline at end of file diff --git a/04/app.js b/04/app.js index e69de29..83f1d2d 100644 --- a/04/app.js +++ b/04/app.js @@ -0,0 +1,18 @@ +function runTimer() { + console.log('start') + + let iter = 0; + const idInterval = setInterval(function () { + + const time = (new Date()).toLocaleTimeString(); + console.log(time); + + iter++; + console.log(iter); + + if (iter === 5) { clearInterval(idInterval); } + + }, 1000); +} + +runTimer()