늘 한글 사이트에서만 검색해서 쓰고 MSDN을 잘 사용하지 않던나..
Google, Naver에 물어보면 다나오니.. ^^;;
바쁜일도 없고 너무 심심해서 MSDN을 열심히 뒤지고 있답니다..
Enumerator 는 쉽게 말해서 Array 대신에 index를 쓰지 않고 Next 를 이용해서 쓸 수 있다는 장점이 있습니다.
심플하게 매핑을 할것이라면 Array 보다 유용하게 쓰이겠네요.. (인데스 필요 없는 경우.. )
[출처] MSDN
http://msdn.microsoft.com/en-us/library/6ch9zb09(VS.85).aspx
JScript
Google, Naver에 물어보면 다나오니.. ^^;;
바쁜일도 없고 너무 심심해서 MSDN을 열심히 뒤지고 있답니다..
Enumerator 는 쉽게 말해서 Array 대신에 index를 쓰지 않고 Next 를 이용해서 쓸 수 있다는 장점이 있습니다.
심플하게 매핑을 할것이라면 Array 보다 유용하게 쓰이겠네요.. (인데스 필요 없는 경우.. )
[출처] MSDN
http://msdn.microsoft.com/en-us/library/6ch9zb09(VS.85).aspx
JScript
Enumerator Object (Windows Scripting - JScript)
Updated: November 2007
Enables enumeration of items in a collection.
enumObj = new Enumerator([collection])
![](http://i.msdn.microsoft.com/Global/Images/clear.gif)
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 only move the current item pointer 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.
![](http://i.msdn.microsoft.com/Global/Images/clear.gif)
The following code shows the usage of the Enumerator object:
function ShowDriveList(){ var fso, s, n, e, x; //Declare variables. fso = new ActiveXObject("Scripting.FileSystemObject"); e = new Enumerator(fso.Drives); //Create Enumerator on Drives. s = ""; for (;!e.atEnd();e.moveNext()) //Enumerate drives collection. { x = e.item(); s = s + x.DriveLetter; s += " - "; if (x.DriveType == 3) //See if network drive. n = x.ShareName; //Get share name else if (x.IsReady) //See if drive is ready. n = x.VolumeName; //Get volume name. else n = "[Drive not ready]"; s += n + "<br>"; } return(s); //Return active drive list. }
![](http://i.msdn.microsoft.com/Global/Images/clear.gif)
![](http://i.msdn.microsoft.com/Global/Images/clear.gif)
'Works > Tip' 카테고리의 다른 글
DB 에 "'" 넣기 (1) | 2008.12.19 |
---|---|
간단한 replaceAll 스크립트 (0) | 2008.11.28 |
[Oracle] where 1=1 의 의미와 활용 (0) | 2008.11.12 |