I got another question regarding jQuery\'s architecture. $(\'div\')
constructs a new jQuery
object:
$(\'div\') instanceof jQuery; /
jQuery objects are "array-like" objects. Consider the code below:
document.forms.length; // returns 1;
document.forms[0]; // returns a form element.
document.forms.join(", "); // throws a type error. this is not an array.
typeof document.forms; // returns "object"
Modifying your code, you could achieve this same affect:
var a =
{
0: 'a',
1: 'b',
2: 'c',
length: 3,
method: function() {
return "test";
}
};