How to sort a string array in ascending order with JavaScript

1 Answer

0 votes
let arr = ["java", "php", "javascript", "nodejs", "c++", "c"]; 
      
arr.sort(); 

console.log(arr); 


/*
run:

["c", "c++", "java", "javascript", "nodejs", "php"]

*/

 



answered May 20, 2020 by avibootz
edited May 20, 2020 by avibootz
...