diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f11b75 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/test.js b/app/test.js index dffc25d..01577b7 100644 --- a/app/test.js +++ b/app/test.js @@ -1 +1,17 @@ -console.log('Wygląda na to, że wszystko działa :)'); \ No newline at end of file +console.log('Wygląda na to, że wszystko działa :)'); +const text = 'Hello, World!'; + +let counter = 0; +//Program wyświetla po znaku z tekstu... +const intervalId = setInterval(() => { + console.log(text[counter]); + counter++; + + //...ręcznie musimy mu powiedzieć kiedy należy przerwać wykonywanie - wtedy proces Node.js się zakończy + if (counter === text.length){ + clearInterval(intervalId); + } +}, 400); +process.argv.forEach((val, index) => { + console.log(`${index}: ${val}`); +}); \ No newline at end of file diff --git a/app/zadanie01.js b/app/zadanie01.js index 8c20173..014dca2 100644 --- a/app/zadanie01.js +++ b/app/zadanie01.js @@ -1 +1,14 @@ -//Twój kod \ No newline at end of file +//Twój kod + +let name = "Aleksandra"; +let surname = "Pocheć"; +console.log(name, surname); + +const intervalId = setInterval(() => { + + console.log("wita się z Node.js!"); + + clearInterval(intervalId); + +}, 5000); + diff --git a/app/zadanie02.js b/app/zadanie02.js index 8c20173..e3f9ddd 100644 --- a/app/zadanie02.js +++ b/app/zadanie02.js @@ -1 +1,49 @@ -//Twój kod \ No newline at end of file +//Twój kod + +console.log("Witam"); + +setTimeout(() => { + + console.log("Node.js"); + +}, 4000); + +setTimeout(() => { + + console.log("się"); + + +}, 1000); + +setTimeout(() => { + + console.log("i korzystam"); + +}, 6000); + +setTimeout(() => { + + console.log("w konsoli"); + +}, 5000); + +setTimeout(() => { + + console.log("z funkcji czasu!"); + +}, 7000); + +setTimeout(() => { + + console.log("z"); + +}, 2000); + +setTimeout(() => { + + console.log("programem"); + +}, 3000); + + +//Witam się z programem Node.js w konsoli i korzystam z funkcji czasu \ No newline at end of file diff --git a/app/zadanie03.js b/app/zadanie03.js index 8c20173..a429dbb 100644 --- a/app/zadanie03.js +++ b/app/zadanie03.js @@ -1 +1,7 @@ -//Twój kod \ No newline at end of file +//Twój kod + +let sum = 0; +for (let i = 2; i { + console.log(Number(argv[i])); + }, Number(argv[i]) * 1000); +} \ No newline at end of file