-
Notifications
You must be signed in to change notification settings - Fork 71
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
Козлов Александр #63
base: master
Are you sure you want to change the base?
Козлов Александр #63
Conversation
🍏 Пройдено тестов 15 из 15 |
var changedCollection = collection.map(function (el) { | ||
return Object.assign({}, el); | ||
}); | ||
functions.sort(function (first, second) { |
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.
Для функции сортировки можно параметры называть a
и b
var fieldsToChoose = [].slice.call(arguments); | ||
|
||
return function select(collection) { | ||
return collection.map(function (el) { |
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.
el
не несет никакой семантики, лучше подойдет название вроде person
|
||
return function select(collection) { | ||
return collection.map(function (el) { | ||
return fieldsToChoose.reduce(function (newCollection, property) { |
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.
Первый аргумент назвал newCollection
, но ведь это не коллеция, а объект с информацией о человеке
console.info(property, values); | ||
|
||
return; | ||
return function filterIn(collection) { |
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.
Снова el
никак не отражает того, что лежит внутри (в общем везде el
нужно поменять)
|
||
return; | ||
return function sortBy(collection) { | ||
var changedCollection = collection.sort(function (first, second) { |
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.
Зачем еще одну переменную создавать? Можно просто collection.sort()
return function sortBy(collection) { | ||
var changedCollection = collection.sort(function (first, second) { | ||
|
||
return (first[property] > second[property]); |
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.
Функция сравнения должна возвращать 1 (если first
> second
по некоторому критерию), 0 (если равны) и -1 (если меньше)
🍅 |
No description provided.