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..37221eb 100644 --- a/02/app.js +++ b/02/app.js @@ -0,0 +1,6 @@ +function sayHello(name){ + console.log('Czesc ' + name + '!') +} + +sayHello('Michal'); +sayHello('devmentor.pl'); \ No newline at end of file diff --git a/03/app.js b/03/app.js index e69de29..28e39da 100644 --- a/03/app.js +++ b/03/app.js @@ -0,0 +1,17 @@ + +const fn = function (num) { + let result = 0; + for (let i = 1; i <= num; i++) { + result += i; + // console.log(i); + } + return result + // console.log(result); +} + +const sumNumbers = fn(4); + +console.log(sumNumbers) + +console.log(fn(10), fn(20)) + diff --git a/04/app.js b/04/app.js index e69de29..0fc5bf3 100644 --- a/04/app.js +++ b/04/app.js @@ -0,0 +1,29 @@ +let idInterval; +let counter = 1; + +function runTimer() { + const time = (new Date()).toLocaleTimeString(); + console.log(time); + // timeCounter(); + // counter++; + // console.log(counter); + // if (counter > 5) { + // console.log('dziala'); + // clearInterval(idInterval); + // } +} + +idInterval = setInterval(function(){ + runTimer(); + timeCounter(); +}, 1000); +// runTimer(); + +function timeCounter(){ + counter++; + if(counter>5){ + clearInterval(idInterval); + } +} + +