Possible Duplicate:
What makes a jQuery object show up as an array in Chrome's Developer Tools?
I am writing a very small, jQuery-like, DOM wrapper in JavaScript, containing only the (few) functions I need most. I have noticed that, when I log a jQuery object to the console of my browser, the object is actually an array. For example: [Document]. I would like to copy that behavior. Can anyone explain me how jQuery does this internally, or even better point me to some relevant lines in the jQuery source code? I know that objects and arrays in JavaScript have much in common, but jQuery seems to return true arrays for the $ selections, not objects. I have already read the following post on stackoverflow but it doesn't seem to answer my question: