array.sort((a,b)=>a-b))
when I use the sort() method to numbers array, what kind of rules do they use to pick a and b from the numbers array?
when I log the a and b in the console, it seems to show array[1] as b, array[0] as a and so on, but when the array is different, it shows different rule.
Is there any way to see how sort()method pick the arguments from the numbers array?
array will be like [2,20,60,300,1000]
or longer.
Thank you.