-
Notifications
You must be signed in to change notification settings - Fork 206
done #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
done #154
Conversation
devmentor-pl
left a comment
There was a problem hiding this 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 ;)
| } | ||
| }); | ||
|
|
||
|
|
There was a problem hiding this comment.
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 = ''; |
There was a problem hiding this comment.
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 = '';
| 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); | ||
| } |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| const sum = arr.reduce((acc, num) => acc + num, 0); | ||
|
|
||
| return sum / arr.length; |
There was a problem hiding this comment.
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 :)
| const sum = grades.reduce((acc, grade) => acc + grade, 0); | ||
| return sum / grades.length; |
There was a problem hiding this comment.
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.
No description provided.