|
October 8, 2000 Iterating through a Collection Tips: October 2000
Yehuda Shiran, Ph.D.
|
|
Similarly to other OOP languages such as C++, JavaScript supports its own iterator mechanism. It is built on top of the Enumerator object. The Enumerator object provides methods to access items in a collection, by iterating through it. Unlike arrays, you cannot access a specific item of the collection. You have to start iterating from the first item and move through the Enumerator object, one item at a time. You create the Enumerator object by the Enumerator() constructor:
where
People who read this tip also read these tips: Look for similar tips by subject: |