How to sort an array of strings in ascending order with JavaScript

1 Answer

0 votes
const array = ["php", "c", "python", "c++", "javascript"];
 
array.sort();
 
console.log(array);
 
       
     
/*
run:
     
["c", "c++", "javascript", "php", "python"] 
     
*/

 



answered Mar 28, 2021 by avibootz
...