Ad
  • Custom User Avatar

    Change return a>b to return b-a and you should be good :). You should always sort an array based on their value and not a comparsion of their values. Otherwise it will act on their Boolean value (true or false), since it's a comparsion operator, and will not sort based on their actual value. See more here.