Skip to content

Conversation

@ArturDevCraft
Copy link

No description provided.

Copy link
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.

Arturze,

Bardzo dobrze sobie poradziłeś! 👍
Zostawiłem drobne uwagi w komentarzach :)

Comment on lines +18 to +26
console.log(
addition,
substraction,
multiplication,
division,
modulo,
increment,
decrement
);
Copy link
Owner

Choose a reason for hiding this comment

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

Można było dodać wyniki działań do tablicy i wykorzystać pętlę do porównywania - byłoby ładnie ;P

}

/* rozwiązanie z pętlą while */
console.log(resultMethod + ' = ' + result);
Copy link
Owner

Choose a reason for hiding this comment

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

👍

Comment on lines +28 to +34
if (a <= b && a <= c) {
return b + c;
} else if (b < a && b <= c) {
return a + c;
} else {
return a + b;
}
Copy link
Owner

Choose a reason for hiding this comment

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

Tutaj również można wykorzystać tablicę - posortować i wybrać dwie pierwsze/ostatnie ;)

console.log('Average value: ' + avg);

function getAvg(arr) {
return arr.reduce((a, b) => a + b) / arr.length;
Copy link
Owner

Choose a reason for hiding this comment

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

Warto pamiętać o drugim parametrze tj. reduce(() => {}, 0) - wtedy pusta tablica nie powoduje błędu

artur.addGrade('physics', 5);

console.log(artur.getAverageGrade('maths'));
console.log(artur.getAverageGrade());
Copy link
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