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.
I had exactly the same issue, I tested this on multiple environments, using a similar sorting function and it is not at all the code's fault. It's probably a problem with the environment (Node.js 6 I believe it is) having a bit of an undefined behavior. MDN highlights that this issue might come up in certain environments: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
Too bad, that was a pretty elegant solution in my opinion.
It's your code's problem. Please review how to use a sorting comparison function properly and raise future code problems as a
question
.I solved it in different ways in either Python and Javascript, without hardcoding anything. what language are you using?
@chucklesoclock
0.0 is a number, '0' is a string.
This comment is hidden because it contains spoiler information about the solution
looking at the test cases seems like we need to change the order in the initial array, not return a new array with swapped values.