Sorting the Freecodecamp data

Sorting the Freecodecamp data
0

#1

I created a function that return a-b but the sort is not exactly working for the recent top brownie points
Any ideas?


#2

I can hazard a guess as to the problem, but please post your code preferably in an online editor like CodePen if I’m off the mark. When you invoke the sort function on an array, it passes each consecutive item in the array as parameters a and b. This means you can not subtract b from a if a and b are objects. You’d need to sort by a.brownie_points or something, so take a look at the objects to see where the actual values are.


#3

No, that wasn’t it but thanks. I was too scared to post my code. In school that’s a no no. I guess I’m trained