Numerical Sort in JavaScript By default, Array.prototype.sort() operates on the basis of string comparison.