Geeksforgeeks Javascript Array Sort Objects