[Guide] Functional Programming: Sort an Array Alphabetically using the sort Method. Fixes and enhancements. (#34678)

This commit is contained in:
Nhat Khanh
2018-12-22 00:20:52 +07:00
committed by Aditya
parent 7feae93dc4
commit e5756ae1d6
2 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ Using this logic, simply reverse engineer the function to return a new array in
function alphabeticalOrder(arr) {
// Add your code below this line
return arr.sort(function(a,b) {
return a > b;
return a !== b ? a < b ? -1 : 1 : 0;
});
// Add your code above this line
}