JS array sorting algorithm internally

JavaScript array sort internally

Write a function to find the specified index values ​​in the array:image-20200310182845340

Test sort () function inside each of the following:

image-20200310183410889

Browser, operating results:

image-20200310183518922

Easy to see, () inside the sort function by direct insertion sort.

Guess you like

Origin www.cnblogs.com/yzh666/p/12457815.html