Numerical Sort in JavaScript
By default, Array.prototype.sort() operates on the basis of string comparison.
By default, Array.prototype.sort()
sorts elements using the UTF-16 code unit sequence. So, pass an appropriate comparison function to the sort function to sort in the numerical order.