5. Summary and References


Summary:


          In summary, sort() method can be used to arrange elements of the array alphabetically. However, when sorting numerical values, a compare function is needed. It will compare each element of the array and sort them. Sorting arrays will help in finding directly the minimum or maximum value in the array. But this method can be inefficient. You can use the Math.min.apply() and Math.max.apply() method to easily find the minimum and maximum values, respectively.


References:

JavaScript Array Sort. (n.d.-a). Retrieved March 30, 2021, from https://www.w3schools.com/js/js_array_sort.asp

JavaScript Array sort: Sorting an Array More Effectively. (n.d.-b). JavaScript Tutorial. Retrieved March 30, 2021, from https://www.javascripttutorial.net/javascript-array-sort/