Skip to content
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

pack 2/task 7 #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

pack 2/task 7 #16

wants to merge 1 commit into from

Conversation

sevaTechoPark
Copy link
Owner

@sevaTechoPark
Copy link
Owner Author

@gooddima96

}

}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Пузырек это круто, но медленнее встроенного сортировщика в разы. Используй его.

if ( library.length <= 1) // пустой массив
return;

if ( initial === undefined ) { // функция преобразования значения отсутствует
Copy link
Collaborator

Choose a reason for hiding this comment

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

Воспользуйся возможностью задать параметры по дефолту. И стрелочные функции заюзай.



function sortLibrary(library, field_name, reverse, initial) {
if ( library.length <= 1) // пустой массив
Copy link
Collaborator

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