Say for eg. implementing the array of anchors object, within document,
so as to parse statement like document.anchors.href
1. Create new array object using JS_NewArrayObject that represents
2. Create new object using JS_NewObject which represents each object
3. Define the properties and functions using JS_DefineProperties and
4. Define this as one of the elements of the array using
5. Repeat 2,3 and 4 based on the number of array elements.
We've tested this approach and it works.
Now our queries:
1. How does the interpreter know which particular array element is
being accessed. Like in case of document.anchors.href,
how can we get the 1.
2. Is there anyway we can avoid step 5. That is instead of creating all
the elements of the array, a way in which we can specify that this is
the prototype of the array elements and avoid adding every single
3. Is this approach correct?