Skip to content

Conversation

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

Natalio,

Całość prezentuje się ok! 👍
Zostawiłem dwa istotne komentarze :)


count(numberA, b);
count(10, 10);
count(10, -10);
Copy link
Owner

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();
Copy link
Owner

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);

Copy link
Author

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ę.

Copy link
Author

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);
Copy link
Owner

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);
Copy link
Owner

Choose a reason for hiding this comment

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

👍

05/app.js Outdated
Comment on lines 58 to 63
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;
Copy link
Owner

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?

Copy link
Author

Choose a reason for hiding this comment

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

@devmentor-pl poprawione

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.

Natalio,

Super, o to chodziło! 👍


const userDataNumber = getUserInput();
const userDataPower = getUserInput();

Copy link
Owner

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;
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