How to sort an array of strings in lexicographical (dictionary, alphabetical) order in JavaScript

1 Answer

0 votes
var array=["javascript", "c", "c++", "java", "c#"]

array.sort()
   
document.write(array);
 
 
/*
run:  
 
c,c#,c++,java,javascript

*/

 



answered Jun 2, 2017 by avibootz
...