JavaScript Sorting Arrays
In this Tutorial, we will learn about JavaScript Sorting Arrays with the help of 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