JavaScript Array sort

JavaScript Array sort


JavaScript Array sort()  
In this Tutorial, we will learn about JavaScript Array sort() method with the help of following below:
Sorts an array in alphabetical order
Syntax
let fruitsList = [“Banana”, “Apple”, “Mango”, “Grapes”];
Example1- Sorting alphabetically a fruitsList with the help of sort() Method:
Output
Example2- Sorting a numList increasing order with the help of sort() Method:
 
 
Output