Can someone tell me why my array is not being sorted numerically? I could understand if the elements were being sorted alphabetically but they’re showing as all number types.
If you don’t provide a compare function the elements are sorted as strings. The conversion to string is just done for comparison - it does not change the type of the elements.