Ad
  • Custom User Avatar

    You should specify if it's OK to alter the list in-place or if a new copy should be created. The default JS sort function will sort an array in-place, which can be surprising. But it also means that it doesn't need to return anything. It's perfectly valid to say var l = [3,2,1].sort(); assert(l[0] === 1), because it mutates l rather than sorting into a new collection.