Did not understand comparator

didn’t understand comparator how it works ,and how to paas it in a function ,and also how to make it

hi @itzzeeshu5,
hope u r comfortable with the compare thing passing to a sort function. If yes then this is the same thing here you are not passing compare to a inbuilt sort function rather to your written bubble sort function. This is the way you’ll pass functions to a function (anyhow this is not useful anywhere). Inside where you where comparing directly at line 17 in the code there he has used the compare function to do the same thing with a function.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.