Created
January 27, 2012 16:59
-
-
Save yu-tang/1689779 to your computer and use it in GitHub Desktop.
CScript/WScript 環境の JScript.Global オブジェクトに既定で追加されているプロパティを調べてみる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
CScript/WScript 環境の JScript.Global オブジェクトに | |
既定で追加されているプロパティを調べてみる | |
*/ | |
(function(obj){ | |
var a = []; | |
for (var i in obj) { | |
a.push(i + ':' + typeof(obj[i])); | |
} | |
WScript.Echo(a.join('\n')); | |
})(this); | |
/* | |
出力: | |
WScript:object | |
WSH:object | |
実行環境が異なるとプロパティも異なるので注意。 | |
たとえば ScriptControl 環境下には当然 WScript も WSH も存在しない。 | |
*/ | |
WScript.Echo('WScript === WSH = ' + (WScript === WSH)); | |
/* | |
出力: | |
WScript === WSH = true | |
単なるエイリアス? | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment