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.
immutability is almost invariably a best practice. Consider a system where the array that is passed to this function was already sorted for a different purpose.
any solution in JS that uses for(var x in pairs) {} and doesn't check pairs.hasOwnProperty(x) should be a failure. If "pairs" happens to be an object that prototypically inherits properties, it will return those as well if hasOwnProperty isn't checked.
Why would any developer make a function to sort an existing array when that function already exists on the array? That's incredibly silly. So yes, to the letter of the "requirement", it works... logically, it makes zero sense to have such a function.
This one is a little broken... it didn't say to sort the existing array.. it said to "output a sorted array"... so sorting the existing one should be a failure, IMO.