Hello!
Could you tell me why Google Chrome and Node would process the following simple sort function differently:
myNumbers = [10, 5, 79, 27, 50, 14, 27];
let i = 0;
console.log(myNumbers.sort((a,b) => {
console.log(a,b);
i++;
return a-b})
);
Both platforms give me the correct end results as expected,
[5, 10, 14, 27, 27, 50, 79]
but the sorting processes seem to be different. For example, the terminal shows the first few sorting process as follows:
[10 5]
[10 79]
[79 27]
[10 27]
...
On the other hand, Google Chrome shows the following:
5 10
79 5
79 10
27 10
...
I thought the process shown by the terminal made sense intuitively, but would also like to know how Chrome does it.
My chrome version is: Version 74.0.3729.157 (Official Build) (64-bit)
Thanks!