I was reviewing javaScript .sort() method, and I got confusion. MDN Web Docs states (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) following: If compareFunction(a, b) returns less than 0, leave a and b unchanged. If compareFunction(a, b) returns 0, leave a and b unchanged with respect to each other, but sorted with respect to all different…