+ 1
J.S. why isn't the .sort() working?
On this code I'm trying to play with it and see if I could put it in alphabetical order. But it doesn't seem to be working. https://code.sololearn.com/WWiRzU4h2fbS/?ref=app (I got the code from w3schhool, and it said .sort() is to sort alphabetic...)
2 odpowiedzi
+ 13
Pass to the sort method a compare function as parameter with logic what you need
arr.sort(compareFunc);
And read about lexicographic ordering in it
+ 3
The sorted output is
Ginfio,Gordon,Henery,Sololearn,calvin,some-guy
If you say this sorting is not working, what is your expected sorting output?