The sort()
method sorts an array alphabetically:
Example
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.sort(); // Sorts the elements of fruits
fruits.sort(); // Sorts the elements of fruits
Practice Excercise Practice now
The sort()
method sorts an array alphabetically:
Practice Excercise Practice now