Share via


item Method (JScript 5.6) 

Returns the current item in the collection.


enumObj.item() 

Remarks

The required enumObj reference is any Enumerator object.

The item method returns the current item. If the collection is empty or the current item is undefined, it returns undefined.

Example

In following code, the item method is used to return a member of the Drives collection.

function ShowDriveList(){

   var fso, s, n, e, x;

   fso = new ActiveXObject("Scripting.FileSystemObject");

   e = new Enumerator(fso.Drives);

   s = "";

   for (; !e.atEnd(); e.moveNext())

   {

      x = e.item();

      s = s + x.DriveLetter;

      s += " - ";

      if (x.DriveType == 3)

         n = x.ShareName;

      else if (x.IsReady)

         n = x.VolumeName;

      else

         n = "[Drive not ready]";

      s +=  n + "<br>";

   }

   return(s);

}

Requirements

Version 3

Applies To: Enumerator Object (JScript 5.6)

See Also

Reference

atEnd Method (JScript 5.6)
moveFirst Method (JScript 5.6)
moveNext Method (JScript 5.6)