Sort an Array Alphabetically using the sort Method - part n

Tell us what’s happening:

I don’t understand what is wrong with this:

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"]);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method

See Sort an Array Alphabetically using the sort Method - Is That True

Thanks, perhaps this is useful information to have in the task-description?

The challenge has been updated but the changes have not been deployed to production. That should happen in the near future.

1 Like