Sort an Array Alphabetically using the sort Method....Code(not Dolphin) not working

Tell us what’s happening:
Code isn’t working. I can’t understand what’s wrong here .

not
Your code so far


function alphabeticalOrder(arr) {
  // Add your code below this line
  return arr.sort((a,b) => a > b);
  // Add your code above this line
}
console.log(alphabeticalOrder(["a", "d", "c", "a", "z", "g"]));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 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

Try reading the documentation on the method
For example this seems interesting:

If compareFunction is not supplied, all non- undefined array elements are sorted by converting them to strings and comparing strings in UTF-16 code units order. For example, “banana” comes before “cherry”.

Here the whole thing:

I did that, I also looked code in hint, copied same in console, but no use…

Have you tried reading the documentation?

Yes, I tried it in my friends PC, it worked. But in mine’s, just this challenge is not correctly functioning…

If you use a > b as return statement it depends on the browser if it works or not, now most don’t support this way of using the sort method
So you need to use a different way
Have you tried something different?
If you post your new code we can tell you how you are going

I got a code that works in my browser.
.
function alphabeticalOrder(arr){
// Add your code below this line
return arr.sort(function(a, b){
return a.localeCompare(b);
})
}
alphabeticalOrder([“a”, “d”, “c”, “A”, “z”, “g”]);
.