-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: master
Are you sure you want to change the base?
pack 2/task 7 #16
Conversation
} | ||
|
||
} | ||
} |
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.
Пузырек это круто, но медленнее встроенного сортировщика в разы. Используй его.
if ( library.length <= 1) // пустой массив | ||
return; | ||
|
||
if ( initial === undefined ) { // функция преобразования значения отсутствует |
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.
Воспользуйся возможностью задать параметры по дефолту. И стрелочные функции заюзай.
|
||
|
||
function sortLibrary(library, field_name, reverse, initial) { | ||
if ( library.length <= 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.
Если не пустой отсортируешь и вернешь, а если пустой ничего не вернешь?
@andrey-e-v