Your function takes two items, I’ll call them left and right. A proper function should return a negative number if
left < right,
0 if equal, and a positive number if
left > right.
If you’re having issues sorting an array, it’s probably because your function doesn’t follow this pattern!
Read more on MDN - Array.sort