Sort an Array Alphabetically using the sort Method101118

Tell us what’s happening:

Your code so far

function alphabeticalOrder(arr) {
  return arr.sort(function(a,b) {
    return a>b;
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/70.0.3538.77 Safari/537.36.

Link to the challenge:

if you console.log the return value of that method, you’ll notice it does not actually sort the array. I recommended reading up on sort.

Bro just use the simple sort method.

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