Skip to content

Conversation

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

Marku,

Rozwiązania są jak najbardziej ok!
Zostawiłem parę drobnych uwag ;)

}
});


Copy link
Owner

Choose a reason for hiding this comment

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

👍

const n = parseInt(prompt('Podaj wykłądnik potęgi: '));

if(n >= 1) {
let result = 1; let i = 0; let formula = '';
Copy link
Owner

Choose a reason for hiding this comment

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

Jeśli chcesz napisać w jednym wierszu to lepiej zrobić to tak:

let result = 1, i = 0, formula = '';

Comment on lines +20 to +29
const max1 = Math.max(num1, num2, num3);

let max2;
if (max1 === num1) {
max2 = Math.max(num2, num3);
} else if (max1 === num2) {
max2 = Math.max(num1, num3);
} else {
max2 = Math.max(num1, num2);
}
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 też utworzyć tablicę i wykorzystać sort - wtedy największe są dwie pierwsze lub dwie ostatnie ;)


const sum = getSum(a, b, c);
const even = isEven(sum);
showInfo(sum, even);
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 +18 to +20
const sum = arr.reduce((acc, num) => acc + num, 0);

return sum / 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 sprawdzić czy tablice nie jest pusta, aby nie dzielić przez 0 :)

Comment on lines +25 to +26
const sum = grades.reduce((acc, grade) => acc + grade, 0);
return sum / grades.length;
Copy link
Owner

Choose a reason for hiding this comment

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

Zwróć uwagę, że ten kod powtarza się z tym z linii 32-33 - może warto napisać funkcję, która zostanie wykorzystana w obu miejscach.

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.

3 participants