I am working on Functional Programming: Sort an Array Alphabetically using the sort Method and I have the syntax and everything right, but I can’t pass the challenge. Then, I used the FCC code, still couldn’t pass.
Your code so far
function alphabeticalOrder(arr) {
// Add your code below this line
return arr.sort(function(a, b) {
return a > b;
});
// Add your code above this line
}
alphabeticalOrder(["a", "d", "c", "a", "z", "g"]);
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method