diff --git a/app/test.js b/app/test.js index dffc25d..370d7d2 100644 --- a/app/test.js +++ b/app/test.js @@ -1 +1,3 @@ -console.log('Wygląda na to, że wszystko działa :)'); \ No newline at end of file +process.argv.forEach((val, index) => { + console.log(`${index}: ${val}`); +}); diff --git a/app/zadanie01.js b/app/zadanie01.js index 8c20173..8c164d6 100644 --- a/app/zadanie01.js +++ b/app/zadanie01.js @@ -1 +1,5 @@ -//Twój kod \ No newline at end of file +//Twój kod +console.log('Miłosz Przybylski'); +setTimeout(() => { + console.log('wita się z Node.js!') +}, 5000); diff --git a/app/zadanie02.js b/app/zadanie02.js index 8c20173..0eaaf9d 100644 --- a/app/zadanie02.js +++ b/app/zadanie02.js @@ -1 +1,31 @@ -//Twój kod \ No newline at end of file +//Twój kod +// Po 4 sekundach od uruchomienia: Node.js +// Po 1 sekundzie od uruchomienia: się +// Od razu po uruchomieniu wyświetl: Witam +// Po 6 sekundach od uruchomienia: i korzystam +// Po 5 sekundach od uruchomienia: w konsoli +// Po 7 sekundach od uruchomienia: z funkcji czasu! +// Po 2 sekundach od uruchomienia: z +// Po 3 sekundach od uruchomienia: programem +setTimeout(() => { + console.log('Node.js'); +}, 4000); +setTimeout(() => { + console.log('się'); +}, 1000); +console.log("Witam"); +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); diff --git a/app/zadanie03.js b/app/zadanie03.js index 8c20173..d9d4bd3 100644 --- a/app/zadanie03.js +++ b/app/zadanie03.js @@ -1 +1,10 @@ -//Twój kod \ No newline at end of file +//Twój kod +const argumentList = process.argv; +const addThese = argumentList.slice(2, argumentList.length); + +let sum = 0; +let solution = addThese.forEach((value) => { + sum += Number(value); + return sum; +}); +console.log(sum); diff --git a/app/zadanieDnia.js b/app/zadanieDnia.js index 8c20173..3e2187e 100644 --- a/app/zadanieDnia.js +++ b/app/zadanieDnia.js @@ -1 +1,8 @@ -//Twój kod \ No newline at end of file +//Twój kod +const sleepSort = process.argv.slice(2); + +sleepSort.forEach(function (n) { + setTimeout(() => { + console.log(n); + }, parseInt(n) * 1000); +});