atEnd 메서드
열거자가 컬렉션 끝에 있는지 여부를 나타내는 부울 값을 반환합니다.
function atEnd() : Boolean
설명
현재 항목이 컬렉션에 있는 마지막 항목이거나, 컬렉션이 비었거나, 현재 항목이 정의되어 있지 않으면 atEnd 메서드는 true를 반환합니다. 그렇지 않으면 False를 반환합니다.
예제
다음 코드에서 atEnd 메서드는 드라이브 목록의 마지막에 도달했는지 확인하는 데 사용됩니다.
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);
}