-
Notifications
You must be signed in to change notification settings - Fork 206
resolved tasks - js basics #155
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.
Marcelu,
Tutaj również parę drobnych uwag :)
| console.log(performAction(a, b, '-')); | ||
| console.log(performAction(a, b, '*')); | ||
| console.log(performAction(a, b, '/')); | ||
| console.log(performAction(a, b, '%')); |
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
| alert('Wartość powinna mieścić się w przedziale 1-9! Podaj cyfrę!'); | ||
| location.reload(); | ||
| } else if (n == 0) { | ||
| console.log(`${a}^${n} = 1`); |
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.
Forma zapisu miała być inna ;) Obecna jest dużo łatwiejsza ;P spróbuj osiągnąć efekt jak w zadaniu ;)
03/app.js
Outdated
| } else if (a < b && a < c){ | ||
| return parseInt(b) + parseInt(c); | ||
|
|
||
| } else if (a < b && a >c){ | ||
| return parseInt(a) + parseInt(b); | ||
| } |
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 wiemy, że a nie jest największa to wiemy, że b i c jest - nie trzeba ponownie tego sprawdzać ;)
PS. Najłatwiej by było zrobić z tych liczb tablicę i posortować ;)
| const isSumEven = isEven(sum); | ||
| console.log(isSumEven); | ||
|
|
||
| showInfo(sum, isSumEven); |
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.
👍
04/app.js
Outdated
| const randomNumber = Math.round((Math.random() * (max - min)) + min); | ||
| array.push(randomNumber); |
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.
Uwaga na dostępy od lewej krawędzi ;)
04/app.js
Outdated
| } | ||
|
|
||
| function getAvg(array){ | ||
| const sum = array.reduce((acc, element) => acc + element); |
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.
Uwaga na pustą tablicę - warto dodać drugi parametr do reduce()
| const avg = student.getAverageGrade(); | ||
| console.log(avg); | ||
|
|
||
| console.log(student); No newline at end of file |
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
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.
Marcelu,
Jest ok, z drobną uwagą ;)
| i++; | ||
| } else if (n == 0) { | ||
| console.log(`${a}^${n} = 1`); | ||
| //zostawilem w tym przypadku zapis a^n, poniewaz a^0 = 1, ciezko to inaczej zapisac |
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.
👍
|
|
||
| let i = 1; | ||
| let sum = a; | ||
| let equation = `${a}` |
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 po prostu zapisać let equation = a
| i++; | ||
| } | ||
|
|
||
| console.log(`${equation} = ${sum}`); |
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 sortedArray = array.sort((a ,b) => b - a); | ||
| const arrayWith2Elements = sortedArray.slice(0, 2); | ||
| const sum = arrayWith2Elements.reduce((acc, el) => acc + el, 0); | ||
| return sum; |
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.