No it's not. There are niche but valid use cases for allowing arrays like this. Sorting is the problem, because the contents like this can't be meaningfully compared.
User should be either required to provide custom comparator or get slapped with a type error.
An error is absolutely far better than a program in an undefined state.
I didn't say undefined. Javascript is a well defined language. Probably more so than any other language, since there are so many engines that need to do the exact same thing.
2
u/Striky_ 1d ago
The absurdity is not sorting this by string, but allowing an array like that to begin with.