Provides direct access to a node in the list.
item(index);
Parameter |
Description |
index |
Can be an integer number that specifies the index of the item in the list or a string that represents the name of the required node in the list |
Return Value
If the node is in the list, the return value is the node object (of type SGNode). Otherwise, the return value is null.
Remarks
In the current implementation, if the list has many items (more than a hundred), accessing node items by name might slow down performance. Therefore, use with caution in some scenarios (e.g., loops).
Example
Getting the fifth node in the node list:
var node2 = node.childNodes.item(5);
Getting the node in the list whose name is “my Poly”:
var node2 = node.childNodes.item("myPoly");