Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
9 changes: 8 additions & 1 deletion 01/app.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
const randomNumber = Math.round(Math.random() * 20);
console.log(randomNumber);

if (randomNumber > 5) {
for (let i = 5; i < randomNumber; i++) {
console.log(i);
}
} else {
console.log('Wylosowana liczba jest zbyt mała, aby uzyć pętli');
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

👍 a

16 changes: 15 additions & 1 deletion 02/app.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
const x = 5;
let result = 0;
let result = 0;
let i = 1;

// for (let i = 1; i <= x; i++) {
// result = result + i;
// }

// console.log(result);

while (i <= x) {
result = result + i;
i++;
}

console.log(result);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

👍

10 changes: 9 additions & 1 deletion 03/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
const x = 10;
let iteration = 0;
let randomNumber = -1;
let randomNumber = -1;

while (x !== randomNumber) {
const number = Math.round(Math.random() * x);
randomNumber = number;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Dlaczego nie od razu? tj. randomNumber = Math.round(Math.random() * x);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Faktycznie! Do poprawy :)

iteration++;
}

console.log(iteration);