Tell us what’s happening:
I’m trying to solve this one, but even when I copy/paste the oficial answer it doesnt work. I think this topic has a bug!
Your code so far
function alphabeticalOrder(arr) {
// Add your code below this line
let newArr = arr.sort(function(a,b) {
return a > b;
});
return newArr;
// Add your code above this line
}
alphabeticalOrder(["a", "d", "c", "a", "z", "g"]);
console.log(alphabeticalOrder(["a", "a", "a", "a", "x", "t"]))
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 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/