When I run the following code in node.js, I get the results that are given. But when I run the same code in this browser I get error messages about what the output should be. Whats going on
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
}
console.log(alphabeticalOrder(["a", "d", "c", "a", "z", "g"]));// ["a", "a", "c", "d", "g", "z"].
console.log(alphabeticalOrder(["x", "h", "a", "m", "n", "m"]));// ["a", "h", "m", "m", "n", "x"].
console.log(alphabeticalOrder(["a", "a", "a", "a", "x", "t"]));// ["a", "a", "a", "a", "t", "x"].
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 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/