You can use it even if array contains objects. And you need to pass compareFunction to do the comparison by yourself.