Sorting with Custom Comparator Functions

Learn about internal sorting and create a comparator function in JavaScript.

The Array Sort Method

There are many algorithms to sort arrays, including bubble sort, merge sort, and quicksort. The JavaScript array object type actually has a .sort() method that will sort the array it’s called on in place and return the sorted version.