Skip to content

Dzień 1 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .idea/Node.js_challenge_dzien_1.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

253 changes: 253 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 17 additions & 1 deletion app/test.js
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
console.log('Wygląda na to, że wszystko działa :)');
console.log('Wygląda na to, że wszystko działa :)');

// const text = "Hello, World!";
// let counter = 0;
//
// const intervalId = setInterval(()=>{
// console.log(text[counter]);
// ++counter;
// if(counter == text.length){
// clearInterval(intervalId)
// }
// },100);

process.argv.forEach((val, index) => {
console.log(`${index}: ${val}`);
});

6 changes: 5 additions & 1 deletion app/zadanie01.js
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
//Twój kod
//Twój kod
console.log("Kuba Matwiejew");
const timeoutId = setTimeout(()=>{
console.log("wita się z Node.js!")
},5000);
39 changes: 38 additions & 1 deletion app/zadanie02.js
Original file line number Diff line number Diff line change
@@ -1 +1,38 @@
//Twój kod
//Twój kod
// const timeout1 = setTimeout(()=>{
// console.log("Node.js")
// },4000);
// const timeout2 = setTimeout(()=>{
// console.log("się")
// },1000);
// const timeout3 = setTimeout(()=>{
// console.log("Witam")
// },0);
// const timeout4 = setTimeout(()=>{
// console.log("i korzystam")
// },6000);
// const timeout5 = setTimeout(()=>{
// console.log("w konsoli")
// },5000);
// const timeout6 = setTimeout(()=>{
// console.log("z funkcji czasu!")
// },7000);
// const timeout7 = setTimeout(()=>{
// console.log("z")
// },2000);
// const timeout8 = setTimeout(()=>{
// console.log("programem")
// },3000);
const text = [`Node.js`, `się`, `Witam`, `i korzystam`, `w konsoli`, `z funkcji czasu!`, `z`, `programem`];
const timer = [4000, 1000, 0, 6000, 5000, 7000, 2000, 3000];
if(text.length == timer.length){
for(let i=0; i<text.length; i++){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Podpowiedź: czytelniejszy były .forEach lub for..in

setTimeout(()=>{
console.log(text[i])
},timer[i])
}
} else {
console.log(`Tablice nie są równe`)
}


7 changes: 6 additions & 1 deletion app/zadanie03.js
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
//Twój kod
//Twój kod
let result = 0;
for (let i = 2; i < process.argv.length; i++) {
result += Number(process.argv[i]);
}
console.log(result);
8 changes: 7 additions & 1 deletion app/zadanieDnia.js
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
//Twój kod
//Twój kod
for (let i = 2; i < process.argv.length; i++) {
let number = parseInt(process.argv[i]);
let timeoutId = setTimeout(()=>{
console.log(number)
},number*1000);
}