diff --git a/app/zadanie01.js b/app/zadanie01.js index 8c20173..797faa2 100644 --- a/app/zadanie01.js +++ b/app/zadanie01.js @@ -1 +1,11 @@ -//Twój kod \ No newline at end of file +//Twój kod + +const text = 'Bartek Jakoniuk'; + + +console.log(text); + +setTimeout(() => { + console.log('wita się z Node.js!') +}, 5000); + diff --git a/app/zadanie02.js b/app/zadanie02.js index 8c20173..8a0ab43 100644 --- a/app/zadanie02.js +++ b/app/zadanie02.js @@ -1 +1,18 @@ -//Twój kod \ No newline at end of file +//Twój kod + +const arr = ['Witam', 'się', 'z', 'programem', 'Node.js', 'w konsoli', 'i korzystam', 'z funkcji czasu!']; +let counter = 0; + + + +const zadanie02 = setInterval(() => { + console.log(arr[counter]); + counter++; + +if (counter === arr.length){ + clearInterval(zadanie02); +} + +}, 1000); + + diff --git a/app/zadanie03.js b/app/zadanie03.js index 8c20173..4431372 100644 --- a/app/zadanie03.js +++ b/app/zadanie03.js @@ -1 +1,12 @@ -//Twój kod \ No newline at end of file +//Twój kod + + + +process.argv.splice(0,2); + +const fn = (prev, curr) => { + return parseInt(prev) + parseInt(curr); +} + +let result = process.argv.reduce(fn); +console.log(result); \ No newline at end of file diff --git a/app/zadanieDnia.js b/app/zadanieDnia.js index 8c20173..df73731 100644 --- a/app/zadanieDnia.js +++ b/app/zadanieDnia.js @@ -1 +1,20 @@ -//Twój kod \ No newline at end of file +//Twój kod + + +process.argv.splice(0,2); + +fn = (a, b) => { + return parseInt(a) > parseInt(b); +} + +process.argv.sort(fn); + +for ( let i = 0; i< process.argv.length; i++){ + +let value = parseInt(process.argv[i]); + + setTimeout(() => { +console.log(parseInt(value)) + + }, 1000*value); +} \ No newline at end of file