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

Модуль 3 #4

Merged
merged 8 commits into from
Feb 18, 2025
Merged

Модуль 3 #4

merged 8 commits into from
Feb 18, 2025

Conversation

dansergey
Copy link
Contributor

Владислав, объясните данный синтаксис, не понимаю, как работает данная стрелочная функция (взял из учебника):
arr.sort( (a, b) => a - b );

@jsru-1
Copy link
Contributor

jsru-1 commented Feb 17, 2025

Добавляю преподавателя (@SinimaWath) для код-ревью.

@jsru-1 jsru-1 requested a review from SinimaWath February 17, 2025 19:57
@SinimaWath
Copy link

arr.sort( (a, b) => a - b );

Это тоже самое, что и :

arr.sort((a, b) => {
  return a - b
})

Массив сортируется в зависимости от того вернулся:
0, число <0 или число >0

@jsru-1 jsru-1 merged commit 4ac5fd2 into js-tasks-ru:master Feb 18, 2025
1 check passed
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