Enumerator Object

Enumerator Object (JavaScript)


Enables enumeration of items in a collection.


This object is supported in Internet Explorer only, not in Windows 8.x Store apps.

enumObj = new Enumerator([collection]) 


Required. The variable name to which the Enumerator object is assigned.


Optional. Any Collection object.

Collections differ from arrays in that the members of a collection are not directly accessible. Instead of using indexes, as you would with arrays, you can move the current item pointer only to the first or next element of a collection.

The Enumerator object provides a way to access any member of a collection and behaves similarly to the For...Each statement in VBScript.

The following code shows the usage of the Enumerator object:

var bytesPerGB = 1024 * 1024 * 1024;

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

var e = new Enumerator(fso.Drives);

var driveString = "";

while (e.atEnd() == false)
    var drv = e.item();

    driveString += drv.Path + " - ";

    if (drv.IsReady){
        var freeGB = drv.FreeSpace / bytesPerGB;
        var totalGB = drv.TotalSize / bytesPerGB;

        driveString += freeGB.toFixed(3) + " GB free of ";
        driveString += totalGB.toFixed(3) + " GB";
        driveString += "Not Ready";

    driveString += "<br />";;


// Output: <drive information

The Enumerator object has no properties.


Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, and Internet Explorer 10 standards. Not supported in Windows 8.x Store apps. See Version Information.

© 2016 Microsoft