Skip to content

Complete tasks from JS arrays#145

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

Complete tasks from JS arrays#145
Katalia91 wants to merge 12 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,

Bardzo dobrze sobie poradziłaś 👍
Zostawiłem parę komentarzy, ale nie wiem czy to były przeoczenia czy po prostu do tak "prostych" chciałaś przetestować innej podejście ;)

Comment thread 01/app.js
console.log(
`Pierwszy użytkownik: ${users[0]}, Drugi użytkownik: ${users[2]}, Trzeci użytkownik: ${users[4]}`
);
console.log(`Długość tablicy: ${users.length}`);
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.

👍

Comment thread 02/app.js
return Math.round(Math.random() * (max-min) + min);
} No newline at end of file
return Math.round(Math.random() * (max - min) + min);
}
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.

👍

Comment thread 03/app.js Outdated
const oddNumbers = []; No newline at end of file
function addOddNumbers(n) {
const oddNumbers = [];
for (i = 1; i <= n; 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, jeśli przed i nie wstawisz let to i staje się zmienną globalną czego nie chcemy :)

Copy link
Copy Markdown
Author

@Katalia91 Katalia91 Aug 14, 2025

Choose a reason for hiding this comment

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

@devmentor-pl przeoczenie, powinnam była jeszcze raz to sprawdzić przed zrobieniem pull requesta ;) Poprawione.

Comment thread 04/app.js Outdated
const years = [1980, 1934, 2002, 2019];

const passedYears = years.map(function (el, index) {
return 2025 - years[index];
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.

Wydaje mi się lepszym rozwiązanie wykorzystać od razu el czyli return 2025 - el - wtedy nie trzeba też pisać drugiego parametru ;)

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 przekombinowałam, poprawione :)

Comment thread 05/app.js Outdated
const evenNumbersSum = arr
.filter((num) => num % 2 === 0)
.reduce((sum, el) => sum + el, 0);
console.log(evenNumbersSum);
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.

Lepiej byłoby zrobić return evenNumbersSum, a console.log zrobić poniżej. Wtedy taka funkcja jest reużywalna ;)

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 poprawiłam, chociaż nie jestem pewna czy to o to chodzilo?

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,

Super, o to chodziło! 👍

Comment thread 03/app.js
Comment thread 04/app.js
Comment thread 05/app.js
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