item 메서드(Visual Studio - JScript)
컬렉션의 현재 항목을 반환합니다.
function item() : Number
설명
item 메서드는 Enumerator 개체의 현재 항목을 반환합니다. 컬렉션이 비었거나 현재 항목이 정의되어 있지 않으면 undefined 값을 반환합니다.
예제
다음 코드에서는 item 메서드가 Drives 컬렉션의 멤버를 반환하는 데 사용되었습니다.
function ShowDrives()
{
var s = "";
var bytesPerGB = 1024 * 1024 * 1024;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var e = new Enumerator(fso.Drives);
e.moveFirst();
while (e.atEnd() == false)
{
var drv = e.item();
s += drv.Path + " - ";
if (drv.IsReady)
{
var freeGB = drv.FreeSpace / bytesPerGB;
var totalGB = drv.TotalSize / bytesPerGB;
s += freeGB.toFixed(3) + " GB free of ";
s += totalGB.toFixed(3) + " GB";
}
else
{
s += "Not Ready";
}
s += "\n";
e.moveNext();
}
return(s);
}