Can anybody solve this mystery for me?
I have an array of dictionaries which I want to sort based on id, increasingly, for example
[{id:1, answer:"hi"}, {id:2, answer:"yo"}]
The following works, but it's the reverse of what I need.
question.answers.sort((a, b) => b.id - a.id);
Logically I'd assume the opposite would work as well, but it doesn't.
question.answers.sort((a, b) => a.id - b.id);