Enumerator

JScript3.0+Syntax

var variable = new Enumerator(collection)

Description

The Enumerator object provides access to items in a collection by allowing iteration through a collection. Accessing items in a collection requires moving the Enumerator object to the first element or the next element using special methods. Unlike arrays, enumerators can not access a specific position. To create and Enumerator object use the Enumerator() constructor. This constructor requires that a collection be passed in as an argument. The methods associated with the Enumerator object are listed in Table 9.7.

Table 9.7. Methods Associated with Enumerator Object
MethodDescription
atEnd()Determines if Enumerator is at the end of the collection
item()Returns ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.