Skip to content

Conversation

@KozlovAlexanderS
Copy link

No description provided.

@honest-hrundel
Copy link

🍏 Пройдено тестов 15 из 15

var changedCollection = collection.map(function (el) {
return Object.assign({}, el);
});
functions.sort(function (first, second) {

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

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

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

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

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

@ninjagrizzly ninjagrizzly Nov 4, 2016

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 (если меньше)

@ninjagrizzly
Copy link

🍅

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.

3 participants