Enumerator.item()

JScript3.0+Syntax

							enumeratorobj.item()

Description

The item() method of the Enumerator object returns the element that the enumerator is pointing to in the collection. If the collection is empty or undefined, undefined is returned.

Example

The item() method is used in Listing 9.43 to access the drive letter and drive type of the current drive.

Listing 9.43 Accessing Drives with the item() Method
 <html> <h1>Drive Letters and drive types:</h1> <script language="JScript"> <!-- Hide //Create enumerator object var fileSysObj = new ActiveXObject("Scripting.FileSystemObject"); var en = new Enumerator(fileSysObj.Drives); //Display drive letter and type for each drive. for (;!en.atEnd();en.moveNext()) { document.write("Drive ...

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.