Skip to content

JS loops: complete tasks#152

Open
Katalia91 wants to merge 3 commits intodevmentor-pl:masterfrom
Katalia91:master
Open

JS loops: complete tasks#152
Katalia91 wants to merge 3 commits intodevmentor-pl:masterfrom
Katalia91:master

Conversation

@Katalia91
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Owner

@devmentor-pl devmentor-pl left a comment

Choose a reason for hiding this comment

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

Natalio,

Jeśli tylko będziesz uważać na deklarację zmiennej iteracyjnej (i) to będzie super! ;)

console.log(randomNumber);

if (randomNumber > 5) {
for (i = 5; i <= randomNumber; i++) {
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.

Uwaga na deklaracje zmiennej! - zabrakło let przy i - w takim wypadku i jest zmienną globalną, co nie jest dobrą praktyką.

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.

@devmentor-pl faktycznie, nie wiem skąd mi się to wzięło - będę pamiętać :)

let result = 0; No newline at end of file

let resultFor = 0;
for (let i = 1; i <= x; i++) {
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.

Tutaj jest już ok :)

resultWhile = resultWhile + j;
j++;
console.log(resultWhile);
}
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.

👍

console.log(randomNumber);
iteration++;
}
console.log(`Potrzebowałaś ${iteration} prób/y.`);
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.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants