-
Notifications
You must be signed in to change notification settings - Fork 206
JS Basics: complete tasks #170
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?
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.
Natalio,
Całość prezentuje się ok! 👍
Zostawiłem dwa istotne komentarze :)
|
|
||
| count(numberA, b); | ||
| count(10, 10); | ||
| count(10, -10); |
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.
👍
02/app.js
Outdated
| } | ||
| console.log(`${str} = ${poweredResult}`); | ||
| } | ||
| calculatePower(); |
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.
Ogólna uwaga do rozwiązania. Lepiej mieć funkcję z parametrami i w ten sposób przekazywać dane.
W drugim rozwiązaniu masz zaszyte w funkcji wiele czynności tj. liczenie potęgi, odbieranie danych od użytkownika. To powoduje, że to rozwiązanie nie jest elastyczne. Lepiej mieć osobną funkcję do liczenia potęgi, osobną do odbierania danych od użytkownika i potem połączenie obu tj.
const a= getUserInput();
const n = getUserInput();
const result = calculatePower(a, n);
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.
@devmentor-pl Faktycznie, w tym zadaniu nie byłam pewna czy mamy od użytkownika pobierać obie liczby do potęgowania, czy tylko jedną (czyli tą, którą chcemy spotęgować). I faktycznie, nie pomyślałam, żeby te dane pobierać osobno. Zaraz to poprawię.
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.
@devmentor-pl poprawiłam, miałam też tam błąd, że prompt zwracał stringa zamiast liczby.
| /* wykorzystanie funkcji */ | ||
| 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.
👍
| return finalAvg; | ||
| } | ||
| const finalResult = calculateFinalAverage(finalArr); | ||
| console.log(finalResult); |
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.
👍
05/app.js
Outdated
| const arrLength = allGrades.length; | ||
| const sumOfAllGrades = allGrades.reduce(function (acc, currentVal) { | ||
| return acc + currentVal; | ||
| }, 0); | ||
| const avg = Math.ceil((sumOfAllGrades / arrLength) * 100) / 100; | ||
| return avg; |
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.
Zaznaczona cześć jest dość mocno podobna do tej z linii 65-70. Może warto napisać metodę/funkcję, którą wykorzystasz w obu miejscach?
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.
@devmentor-pl poprawione
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.
Natalio,
Super, o to chodziło! 👍
|
|
||
| const userDataNumber = getUserInput(); | ||
| const userDataPower = getUserInput(); | ||
|
|
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 avgOfOne = Math.ceil((sum / numOfElements) * 10) / 10; | ||
| return avgOfOne; | ||
| const avg = this.calculateAvg(subjectArray); | ||
| return avg; |
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.
👍
No description provided.