return ((a.id > b.id) ? -1 : 1);
What does -1 and 1 mean? I know, that if a is bigger than b it is -1 and otherwise 1. But what does -1 and 1 mean? For which purpose would I use 0?
PS: This return function is to sort an array by id.
Aucun commentaire:
Enregistrer un commentaire