Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
.
Yes, negative numbers are truthy and that is necessary for this to work.
Both compareStats and sortStats list comparisons in priority order. The or "||" operator falls through to the next comparison only when the previous result was 0 (falsey), meaning the two items were considered equal by the previous comparison. A non-zero value (negative or positive) indicates we already know the relative order of the two items and don't need to look at further comparisons.
The result can then be used by the array sort method to actually sort the items. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
There is no issue, 15 people solved the kata! And so did you! Next time close the issue, when you can solve the kata and see yourself, that there is no issue!