Skip to content

Complete all tasks#146

Open
MstowskaSandra wants to merge 5 commits intodevmentor-pl:masterfrom
MstowskaSandra:master
Open

Complete all tasks#146
MstowskaSandra wants to merge 5 commits intodevmentor-pl:masterfrom
MstowskaSandra:master

Conversation

@MstowskaSandra
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.

Sandro,

Zadania są ok 👍
Zostawiłem w komentarzach parę drobnych uwag ;)

Comment thread 01/app.js
console.log("Pierwszy użytkownik:", users[0]);
console.log("Trzeci użytkownik:", users[2]);
console.log("Piąty użytkownik:", users[4]);
console.log("Liczba elementów tablicy:", users.length); No newline at end of file
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



for(i = 0; i<randomArray.length; 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 deklarację (let) zmiennej. Jeśli nie podamy tego słowa kluczowego przed i to staje się ona globalna, czego nie chcemy.

Comment thread 03/app.js
oddNumbers.push(allNumbers[j]);
}
}
console.log(oddNumbers);
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 raczej powinniśmy użyć return, aby zwrócić dane. TO pozwoli na elastycznosć takiej funkcji. W obecnym kształcie raczej jej nigdzie nie wykorzystamy :P

Comment thread 03/app.js
}

const onlyOddNumbers = function(n) {
const allNumbers = fullArray(n);
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.

Zastanowiłbym się czy jest sens tworzenia całej tablicy, aby potem utworzyć nową.
Nie lepiej od razu w pętli poniżej uzupełniać tablicę odpowiednimi danymi?
Z punktu wydajności to rozwiązanie będzie lepsze ;)

Comment thread 04/app.js

function myFunction(num) {
return 2025 - num;
}
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 05/app.js

const shorterNotation = numbers.filter(num => num % 2 === 0).reduce((total, num) => total + num, 0);

console.log("Nie ma to jak funkcje strzałkowe:", shorterNotation); No newline at end of file
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