returns the node located at the specified offset into the collection.
Note: Because the contents of an
live, changes to the underlying DOM can and will cause the position of individual
nodes in the collection to change, so the index value will not necessarily remain
constant for a given node.
The position of the
Nodeto be returned. Elements appear in an
HTMLCollectionin the same order in which they appear in the document's source.
Node at the specified index, or
index is less than zero or greater than or equal to the length property.
item() method returns a numbered element from an
HTMLCollection as an array and to index it using array notation. See the
const images = document.images; // This is an HTMLCollection const img0 = images.item(0); // You can use the item() method this way const img1 = images; // But this notation is easier and more common
BCD tables only load in the browser