diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..6f3a291 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5501 +} \ No newline at end of file diff --git a/01/app.js b/01/app.js index e69de29..fd795bb 100644 --- a/01/app.js +++ b/01/app.js @@ -0,0 +1,7 @@ +function showTime() { + console.log(time); +} + +const time = (new Date()).toLocaleTimeString(); + +showTime(); \ No newline at end of file diff --git a/02/app.js b/02/app.js index e69de29..7d20cc0 100644 --- a/02/app.js +++ b/02/app.js @@ -0,0 +1,7 @@ +function sayHello(name) { + console.log('Cześć ' + name); +} + +const name = 'devmentor.pl'; + +sayHello(name); \ No newline at end of file diff --git a/03/app.js b/03/app.js index e69de29..f0f52ab 100644 --- a/03/app.js +++ b/03/app.js @@ -0,0 +1,9 @@ +const sumNumUpTo = function(number) { + let sum = 0; + for(let i=1; i<=number; i++) { + sum = sum + i; + } + return sum; +} + +console.log(sumNumUpTo(4)); \ No newline at end of file diff --git a/04/app.js b/04/app.js index e69de29..4442201 100644 --- a/04/app.js +++ b/04/app.js @@ -0,0 +1,19 @@ +let counter = 0; + +function runTimer() { + const idInterval = setInterval(function() { + const time = (new Date()).toLocaleTimeString(); + console.log(time); + + counter++; + + if(counter === 5) { + clearInterval(idInterval); + } + + }, 5000); +} + +runTimer(); + +