Skip to content

made task#1

Open
KHYehor wants to merge 7 commits intomachendos:masterfrom
KHYehor:master
Open

made task#1
KHYehor wants to merge 7 commits intomachendos:masterfrom
KHYehor:master

Conversation

@KHYehor
Copy link
Copy Markdown

@KHYehor KHYehor commented Oct 7, 2018

Гит Игнор не ставил на лог файл, а так сделал как понял, жду вразумительных ревьюх.

class ArrayAdvanced extends Array {
constructor(array) {
super();
this.array = array.slice();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Конструктор нужно переписать. Он должен иметь тот-же контракт, что и обычный Array. Сейчас - это объект со свойством array

this.array = array.slice();
}
specialSort(collection) {
if (collection.hasOwnProperty('sort')) collection.sort(this.array);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Функция сортировки, а так же все остальные функции из опционального объекта - функции, которые перебирают один элемент массива. Они не должны сортировать сразу весь массив

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

как функция сортировки будет сортировать один элемент массива?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Почитай про колбек в Array.prototype.filter: https://www.ecma-international.org/ecma-262/8.0/#sec-array.prototype.filter

Copy link
Copy Markdown
Owner

@machendos machendos left a comment

Choose a reason for hiding this comment

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

Всё ок, только куда делся фильтр?)

@KHYehor
Copy link
Copy Markdown
Author

KHYehor commented Oct 12, 2018

Как тебе такое Илон Маск? Функциональность и подход к задаче

@machendos
Copy link
Copy Markdown
Owner

Переименуй класс в AdvancedArray, а методы в unsideTransform для неизменяющего массив метода, и в sideTransform для изменяющего, и затем экспортируй его, поместив в объект: module.exports = { AdvancedArray }
Чтобы это всё дело само проверилось

@KHYehor
Copy link
Copy Markdown
Author

KHYehor commented Oct 13, 2018

методы в unsideTransform для неизменяющего массив метода, метод не изменяет массив в классе? он возвращает новый измененный массив?

@machendos
Copy link
Copy Markdown
Owner

Он не изменяет массив, однако возвращает массив-результат: первый и/или последний элемент массива, или вообще пустой массив

@machendos
Copy link
Copy Markdown
Owner

Можно реализовать только один, но назови его правильно

@machendos
Copy link
Copy Markdown
Owner

А файл в solve.js

@machendos
Copy link
Copy Markdown
Owner

screenshot_2018-10-13-15-47-22

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