Skip to content

resolved tasks - arrays#136

Open
marrcelp wants to merge 6 commits intodevmentor-pl:masterfrom
marrcelp:master
Open

resolved tasks - arrays#136
marrcelp wants to merge 6 commits intodevmentor-pl:masterfrom
marrcelp:master

Conversation

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

Marcelu,

Tutaj również super, z drobną uwagą ;)

Comment thread 01/app.js
const users = ['Janusz Kowalski', 'Robert Lewandowski', 'Jan Pawel', 'Edzia Gorniak', 'Marcin Najman'];

console.log(users[0], users[2], users[4]);
console.log(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
console.log(` Ostatni element tablicy to: ${arr[arr.length - 1]}`);
}

showArrayElement(randomArray); 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 03/app.js
console.log(arr);
}

showOddNumbers(n); 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 04/app.js
const currentYear = currentDate.getFullYear();

const yearsToDate = years.map((element) => currentYear - element);
console.log(yearsToDate);
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 Outdated


const evenNumbers = numbers.filter((element) => element%2===0);
const sum = evenNumbers.reduce((acc, el) => acc+ el);
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 na wszelki wypadek warto dodać drugi parametr tj. evenNumbers.reduce((acc, el) => acc+ el, 0);, aby nie było błędu jak będzie pusta tablica.

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.

👍

Comment thread 05/app.js

const evenNumbers = numbers.filter((element) => element%2===0);
const sum = evenNumbers.reduce((acc, el) => acc+ el);
const sum = evenNumbers.reduce((acc, el) => acc + el, 0);
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