Because it's not part of jQuery (officially), but is a proxied Array.sort.
As Derek points out, jQuery(...)
does not return an array. Rather, jQuery adds a proxy to make the jQuery object "act like an array":
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: push,
sort: [].sort, // <-- here
splice: [].splice
This proxy works because the this
in a function is determined by the object on which the function was invoked. And, furthermore, Array.sort
(and Array.splice
) work on any this
that is "array like" (has a length
and presumably properties 0..length-1
). Here is an example of a custom object [ab]using Array.sort
:
var a = {0: "z", 1: "a", length: 2, sort: [].sort}
a[0] // -> "z"
a.sort() // in-place modification, this === a
a[0] // -> "a"
a instanceof Array // -> false (never was, never will be Array)
YMMV following the "For internal use only" notes.