Recently when I was working with JavaScript \"sort()\" function, I found in one of the tutorials that this function does not sort the numbers properly. Instead to sort numbe
The “default” comparison function calls toString on both values and does a lexicographical comparison on the string representations. V8 engine uses Timsort algorithms which runs in O(nlogn).
Source