Ad
  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.